Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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
share|improve this answer
    
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
    
That makes sense. Thanks! –  Thomas Shaw Jan 28 '13 at 15:28
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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