When I try to use write to talk to users logged into an X session results vary depending on which terminal they are using. Gnome terminal can pick up writes, but neither lxterminal nor terminator can. The reason is that lxterminal and terminator don't have associated pts devices:

With lxterminal(s) running:

$ who
tshaw    tty7         2013-01-27 21:34

With Gnome terminal running:

$ who
tshaw    tty7         2013-01-27 21:34
tshaw    pts/1        2013-01-27 22:25 (:0)

(the tty7 entry in the above is the X session)

Is there a way to configure other terminals to take pts devices or would that have to be done in source code?


Original question

All of the mentioned programs have a pts. The problem is not that your specified terminals don't have a pts device but that the information isn't recorded.

Why doesn't lxterminal or other terminals show up in who

who retrieves it information from a utmp file, typically /var/run/utmp and is written to by programs themselves. In order to write an utmp entry programs have to have access to the file which normal, standard applications like lxterm or urxvt don't have.

Allow access to /var/run/utmp for applications

Typically /var/run/utmp is not write-able for the normal user, i.e. programs can't create new entries as a malicious user could just overwrite the file or write fake entries.

On my system /var/run/utmp has following permissions:

$ ls -l /var/run/utmp 
-rw-rw-r-- 1 root utmp 3072 Jan 28 08:26 /var/run/utmp

that means in order to write to the file you have to have at least to be in the group.

The best solution to give permissions to programs for updating /var/run/utmp is changing the permissions of the program so it can update the file. You can do this by setting the group of the executable to utmp and set the setgid flag which means it will set the group id from the file permissions, i.e.:

chgrp utmp /usr/bin/urxvt
chmod g+s /usr/bin/urxvt
  • I tried what you said and got this message: This process is currently running setuid or setgid. This is not a supported use of GTK+. You must create a helperprogram instead. For further details, see: http://www.gtk.org/setuid.html. Maybe this isn't possible with these terminals then. However, I also noticed that permissions/ownership for gnome-terminal are the same as they were for lxterminal in the beginning. – Thomas Shaw Jan 28 '13 at 14:27
  • @ThomasShaw gnome-terminal uses gnome-pty-helper which has the appropiate permissions – Ulrich Dangel Jan 28 '13 at 14:44
  • While that used to be true, terminal emulators are now switching to using libutempter which uses a setgid helper to update utmp (on my system /usr/lib/utempter/utempter). – Stéphane Chazelas Jan 28 '13 at 17:22
  • @StephaneChazelas the underlying issue (permission) is exactly the same. vte uses/used also the gnome-pty-helper – Ulrich Dangel Jan 28 '13 at 18:35
  • if you try to set lxterminal setgid on a recent system, gtk will complain (<pre>Gtk-WARNING **: This process is currently running setuid or setgid. This is not a supported use of GTK+. You must create a helper program instead. For further details, see: gtk.org/setuid.html Refusing to initialize GTK+.</pre>) and you need to use a helper. – Stéphane Chazelas Jan 28 '13 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.