Thursday, January 16, 2014

Roll Your Own Free Opensource Secure ChatRoom From The Command Line


chat participants need only have passwordless ssh login to a shared trusted host.

#just fill out the following parameters:

trusted_user_host=user@mydomain.com
chat_username=pick_a_username
chat_room=pick_a_chatroom

#first set up a chat window where chats will be displayed:
  ssh $trusted_user_host "touch $chat_room; tail -f $chat_room" 

#second setup another window for sending in chat messages:
  while read line; do echo "$chat_username: " $line | ssh $trusted_user_host "cat -u >> $chat_room"; done; 

#sample output:

~/Desktop$  ssh $trusted_user_host "touch $chat_room; tail -f $chat_room" 
me:  test
me:  hey
you:  hey back at you
me:  we are chatting without a hassle
you:  we sure are


#to terminate the chat simply  ctrl-c exit the loop:
#Any participant can truncate the chat history at anytime with:
  ssh $trusted_user_host "echo "" > $chat_room"; 
#looks like this in the log:
 tail: mytopic: file truncated 

No comments:

Post a Comment