screen
doesn't unset the environment variable; it is removed by Linux itself.
On most systems, the /usr/bin/screen
executable is installed with the setgid bit for utmp
group, in order to be able to modify the utmp
database. It also uses setgid to control access to the socket directory (/var/run/screen/
).
On Linux, when a setuid (or setgid) program is ran, it does not receive certain environment variables (including LD_LIBRARY_PATH
, several other LD_*
variables, and HOSTALIASES
), in order to reduce the possible attack points: Otherwise you could write a small library and trick su
or sudo
into calling your "improved" functions that way.
You can remove the setgid bit from screen
, but you will have to make the socket directory fully accessible by everyone (mode 0777). It shouldn't be a security risk, though, as screen
also checks the attacher's UID itself.
However, you should not make the utmp
database world-writable.
you have export LD_KLIBRARY_PATH before run screen? – kinnou02 – 2011-01-20T14:56:30.443
Superuser question. – karlphillip – 2011-01-20T14:57:25.763
Sorry, can I somehow move it over, or should I delete and repost? – None – 2011-01-20T15:07:44.377
If you get five close votes, it will be bumped there automatically. One more to go! – Thomas – 2011-01-20T17:29:29.890