DISPLAY is not exported, sometimes

Patrick O'Callaghan pocallaghan at gmail.com
Sat Jul 23 23:38:38 UTC 2011


On Sat, 2011-07-23 at 17:53 -0400, David A. De Graaf wrote:
> As I understand it (from the golden years of UNIX), what happens when
> I type   /bin/su - dad   is roughly this:
> - the shell forks, creating a child with all of the parent's exported
>   environment but not the rest, and including stdin, stdout, and
> stderr.

RTFM. According to the info page on su:

`-'
`-l'
`--login'
     Make the shell a login shell.  This means the following.  Unset all
     environment variables except `TERM', `HOME', and `SHELL' (which
     are set as described above), and `USER' and `LOGNAME' (which are
     set, even for the super-user, as described above), and set `PATH'
     to a compiled-in default value.  Change to USER's home directory.
     Prepend `-' to the shell's name, intended to make it read its
     login startup file(s). When this option is given, /etc/pam.d/su-l
     PAM file is used instead of the default one.

IOW the DISPLAY environment variable will not be passed to the child
shell in this case.

poc



More information about the users mailing list