How to Setup Secure Private Chat Server with Ytalk over SSH

[‘

n

Ytalk is a free multi-user chat program which works similar to the UNIX talk program. The main advantage of ytalk is that it allows for multiple connections and can communicate with any arbitrary number of users simultaneously.

n

In this article, we will explain how to install and setup a private, encrypted and authenticated chat server with Ytalk over SSH for secure, password-less access into the chat server, for each participant.

n

Read Also: ssh-chat – Make Group/Private Chat with Other Linux Users Over SSH

n

Installing Ytalk and OpenSSH Server in Linux

n

Install Ytalk and OpenSSH Server using APT package manager as shown.

n

$ sudo apt-get updatern$ sudo apt-get install ytalk openssh-serverrn

n

Once installed, openbsd-inetd and sshd services should be auto-started by the installer. You can check if they are up and running as shown:

n

$ sudo systemctl status openbsd-inetdrn$ sudo systemctl status sshdrnORrn$ sudo service openbsd-inetd statusrn$ sudo service sshd  statusrn

n

Now create a user account called talkd and add it to the group tty on the system.

n

$ sudo useradd talkdrn$ sudo usermod -a -G tty talkdrn

n

Now you need to configure inetd, open its main configuration file using your favorite text editor and edit it as explained below.

n

$ sudo vim /etc/inetd.confrn

n

Scroll down to the lines:

n

talk dgram udp wait nobody.tty /usr/sbin/in.talkd in.talkdrnntalk dgram udp wait nobody.tty /usr/sbin/in.ntalkd in.ntalkdrn

n

and change them to look like this (replace the username “nobody” with “talkd“).

n

talk dgram udp4 wait talkd.tty /usr/sbin/in.talkd in.talkdrnntalk dgram udp4 wait talkd.tty /usr/sbin/in.ntalkd in.ntalkdrn

n

Configure inetd
Configure inetd

n

Then restart the openbsd-inetd for the recent changes to take effect, by running.

n

$ sudo systemctl restart openbsd-inetdrnORrn$ sudo service openbsd-inetd restart rn

n

Create User Accounts and Configure SSH

n

Now its time to create user accounts for all the participants in the chat server with the adduser command.

n

$ sudo adduser tecmintrn$ sudo adduser ravirn

n

Afterwards, you need to configure password-less SSH login for all user accounts. The users need to create a private and public key combination on their local machines. Then the users need to send you the administrator, the contents of their public keys to add into a file known as authorized_keys, their home directory under /home/$USER/.ssh (for each user).

n

For example, to setup user tecmint after receiving the contents of his public key, do the following.

n

$ mkdir /home/tecmint/.sshrn$ chmod 600 /home/tecmint/.sshrn$ vim /home/tecmint/.ssh/authorized_keys  #copy and paste the contents of the public key in herern$ chmod 600 /home/tecmint/.ssh/authorized_keysrn

n

Testing the Secure Chat Server

n

At this stage, you now need to test if the chat server is working fine. Simply log into the server then run the ytalk command. For instance, if tecmint user wishes to chat with user ravi, all he can do is run.

n

$ ytalk ravirn

n

Then user ravi after login, can run the following command to start chatting.

n

$ ytalk tecmintrn

n

Ytalk Chat Room on Linux
Ytalk Chat Room on Linux

n

That’s all! In this article, we have shown how to setup a private chat server with Ytalk over SSH. Share your comments via the feedback form below.

n

‘]