]> git.ipfire.org Git - thirdparty/util-linux.git/commit
su: (pty) change owner and mode for pty
authorKarel Zak <kzak@redhat.com>
Tue, 23 Feb 2021 10:52:45 +0000 (11:52 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 23 Feb 2021 10:52:45 +0000 (11:52 +0100)
commit17d5b264367debb745b678fcafacbaa938b29455
treeb24b5b31582878564d8b395fb928e255d52eb280
parent726ffb4a26153e1ae881612065940580f0a24cdb
su: (pty) change owner and mode for pty

The current situation:

 # su --pty - kzak
 $ ll $(tty)
 crw--w---- 1 root tty 136, 9 Feb 23 11:53 /dev/pts/9
 $ mesg
 mesg: cannot open /dev/pts/9: Permission denied

the pseudo-terminal is still owned by the original user.

New version:

 # su --pty - kzak
 # ll $(tty)
 crw--w---- 1 kzak tty 136, 9 Feb 23 11:56 /dev/pts/9
 # mesg
 is y

The patch follows login(1) to change the pty owner and group. It
follows "TTYPERM" and "TTYGROUP" from login.defs (or econf lib).

Signed-off-by: Karel Zak <kzak@redhat.com>
include/pty-session.h
lib/pty-session.c
login-utils/su-common.c