Difference between revisions of "Talkd and the talk command"

From ArchWiki
Jump to: navigation, search
(Alternate method that avoids the necessity of xinetd.)
m (formatting and minor wording)
Line 3: Line 3:
 
The "talk" command allows you to talk to other users on the same system, which is useful if you're both SSH'd in from somewhere. Using it is very simple; to talk to someone the command is just
 
The "talk" command allows you to talk to other users on the same system, which is useful if you're both SSH'd in from somewhere. Using it is very simple; to talk to someone the command is just
  
<pre>talk <username> <tty></pre>
+
{{bc|talk <username> <tty>}}
  
 
Of course, you can talk to users on another system as well:
 
Of course, you can talk to users on another system as well:
  
<pre>talk <username>@<hostname> <tty></pre>
+
{{bc|talk <username>@<hostname> <tty>}}
  
 
In either case, the tty is optional. It is used if you wish to talk to a local user who is logged in more than once to indicate the appropriate terminal name. "tty" is of the form 'ttyXX', or 'pts/X'.
 
In either case, the tty is optional. It is used if you wish to talk to a local user who is logged in more than once to indicate the appropriate terminal name. "tty" is of the form 'ttyXX', or 'pts/X'.
  
However, getting it working requires some setup.
+
== Setup ==
  
1. First, install the inetutils package, which contains talk and talkd. These also rely on xinetd, so install that as well. You might also need the screen command; it's in the screen package.
+
=== Using xinetd ===
  
<pre>pacman -S inetutils xinetd screen</pre>
+
# First, install the inetutils package, which contains talk and talkd. These also rely on xinetd, so install that as well. You might also need the screen command; it's in the screen package. {{bc|1=
 
+
pacman -S inetutils xinetd screen
2. Configure the xinetd service entry in /etc/xinetd.d/talk by setting "disable = no" in /etc/xinetd.d/talk.
+
}}
 
+
# Configure the xinetd service entry by editing {{ic|/etc/xinetd.d/talk}} and setting "disable = no".
3. If you are using tcp_wrappers or something similar, Add an allow entry like this:
+
# If you are using tcp_wrappers or something similar, add an entry to {{ic|/etc/hosts.allow}}: {{bc|1=
 
+
talkd: 127.0.0.1
<pre>talkd: 127.0.0.1</pre>
+
}}
 
+
# Now start xinetd: {{bc|1=
4. Now start xinetd:
+
systemctl start xinetd.service
 
+
}}
<pre>systemctl start xinetd.service</pre>
+
# If you're on the local system, you might need to start a screen session to make yourself show up on the "w" and "who" commands -- you need to show up there or talk won't work.
 
+
# Allow write access in your terminal if needed: {{bc|1=
5. If you're on the local system, you might need to start a screen session to make yourself show up on the "w" and "who" commands -- you need to show up there or talk won't work.
+
mesg y
 
+
}}
6. Allow write access in your terminal:
+
 
+
<pre>mesg y</pre>
+
  
 
Talk should work now.
 
Talk should work now.
  
You can also use systemd sockets instead of installing xinetd.
+
=== Using systemd directly ===
  
First, copy the following as /etc/systemd/system/talkd.service:
+
First, create the following two files in {{ic|/etc/systemd/system}}:
  
<pre>
+
{{hc|/etc/systemd/system/talkd.service|2=
 
# Adapted from original by Zbigniew Jedrzejewski-Szmek; see RedHat Bug 737219
 
# Adapted from original by Zbigniew Jedrzejewski-Szmek; see RedHat Bug 737219
  
Line 55: Line 52:
 
[Install]
 
[Install]
 
Also=talk.socket
 
Also=talk.socket
</pre>
+
}}
 
+
Second, copy the following as /etc/systemd/system/talkd.socket:
+
  
<pre>
+
{{hc|/etc/systemd/system/talkd.socket|2=
 
# Adapted from original by Zbigniew Jedrzejewski-Szmek; see RedHat Bug 737219
 
# Adapted from original by Zbigniew Jedrzejewski-Szmek; see RedHat Bug 737219
  
Line 71: Line 66:
 
[Install]
 
[Install]
 
WantedBy=sockets.target
 
WantedBy=sockets.target
</pre>
+
}}
  
Third, activate the talkd daemon:
+
Then activate the talkd daemon:
  
<pre>
+
{{bc|$ sudo systemctl start talkd}}
$ sudo systemctl start talkd
+
</pre>
+
  
 
Now, the Lennart is strong in you!
 
Now, the Lennart is strong in you!

Revision as of 17:14, 4 November 2013

The "talk" command allows you to talk to other users on the same system, which is useful if you're both SSH'd in from somewhere. Using it is very simple; to talk to someone the command is just

talk <username> <tty>

Of course, you can talk to users on another system as well:

talk <username>@<hostname> <tty>

In either case, the tty is optional. It is used if you wish to talk to a local user who is logged in more than once to indicate the appropriate terminal name. "tty" is of the form 'ttyXX', or 'pts/X'.

Setup

Using xinetd

  1. First, install the inetutils package, which contains talk and talkd. These also rely on xinetd, so install that as well. You might also need the screen command; it's in the screen package.
    pacman -S inetutils xinetd screen
  2. Configure the xinetd service entry by editing /etc/xinetd.d/talk and setting "disable = no".
  3. If you are using tcp_wrappers or something similar, add an entry to /etc/hosts.allow:
    talkd: 127.0.0.1
  4. Now start xinetd:
    systemctl start xinetd.service
  5. If you're on the local system, you might need to start a screen session to make yourself show up on the "w" and "who" commands -- you need to show up there or talk won't work.
  6. Allow write access in your terminal if needed:
    mesg y

Talk should work now.

Using systemd directly

First, create the following two files in /etc/systemd/system:

/etc/systemd/system/talkd.service
# Adapted from original by Zbigniew Jedrzejewski-Szmek; see RedHat Bug 737219

[Unit]
Description=Talk Server
Documentation=man:talk(1) info:talk
Requires=talkd.socket

[Service]
User=nobody
Group=tty
ExecStart=/usr/sbin/talkd
StandardInput=socket

[Install]
Also=talk.socket
/etc/systemd/system/talkd.socket
# Adapted from original by Zbigniew Jedrzejewski-Szmek; see RedHat Bug 737219

[Unit]
Description=Talk Server Activation Socket
Documentation=man:talk(1) info:talk

[Socket]
ListenDatagram=0.0.0.0:518

[Install]
WantedBy=sockets.target

Then activate the talkd daemon:

$ sudo systemctl start talkd

Now, the Lennart is strong in you!