Gentoo Wiki




Have a shell server and would like to enter an interactive chat with other users in your terminal session? You could use `write username` but this is a very clumsy way to have two way communication. If everyone uses ssh to the box, you can have a nice secure private chat (more secure than connecting to a public IRC network).

Getting Started

First you will need to install netkit-talk which will provide the talk daemon and client. You will also need xinetd which will enable the talk daemon to run.

# emerge netkit-talk xinetd

Now you need to initialize the talk daemon so that people can connect to it and initiate conversations. To do that we edit the default configuration file to look like this:

File: /etc/xinetd.d/talk
service ntalk
#       flags                   = IPv4
        disable                 = no     
        socket_type             = dgram
        wait                    = yes
        user                    = root
        group                   = tty
        server                  = /usr/sbin/in.talkd

Next you will have to make sure that your talkd tries to open to connections on "localhost" and not on your FQDN or IP address, this is because by default xinetd does not allow connections from anything except localhost. To do this you will have to set localhost as the first option in your list of localhost domains:

File: /etc/hosts       localhost  other.domain

Now restart your xinetd:

# /etc/init.d/xinetd restart

And now you're ready for the client stuff!

Using talk

When you installed netkit-talk it came with a talk client. Basic usage is thus:

$ talk user ttyname

Where ttyname is the terminal session they are logged into that you wish to bug with your invite (e.g. tty1 or pts/0 and etc). If they are logged in only once, you do not need to add this argument. They will be rudely interrupted with a message that looks like this:

Message from Talk_Daemon@localhost at 13:46 ...  
talk: connection requested by user@localhost.    
talk: respond with:  talk user@localhost 

They can then continue doing whatever it is they did, but as long as you keep your invitation screen open the message will keep repeating for them, so if they don't answer soon, please end your invitation with a ctrl-c (which is also the client quit command once you're done chatting). They can complete the invitation by running the command

$ talk user     (where user is the one who initiated the call)

Voila! Chats! There is another talk client called ytalk in portage which I like better, so try them both out and be sure to read their manpages for more cool functionality.


If when inviting someone to chat you get a message like this:

[Your party is refusing messages]

It means they have messaging disabled. You can check your messaging status by using the mesg command.

$ mesg y      (to enable messaging)
$ mesg n      (to disable messaging)
$ mesg        (to view your current messaging status)

Note that mesg n will also disable being able being `write`n to.

Another common error is if when you start the invitation and get messages like this:

[No connection yet]
[Checking for invitation on caller's machine]

Try inviting someone to talk using this command:

$ ytalk -h localhost user

This will force the talkd to open on the localhost interface, in case your /etc/hosts changes did not take effect.

Another handy tip: with ytalk to add more people to your existing chat is easy! From in your chat window use the 'Esc' key to bring up your menu and 'a' to prompt for which user to add.

Retrieved from ""

Last modified: Thu, 04 Sep 2008 23:49:00 +0000 Hits: 2,024