[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [SOLUTION] Re: Bullseye: setting and using $DISPLAY after su -



On Tue, Jan 05, 2021 at 10:38:39PM -0600, David Wright wrote:
> But here on debian-user, I was really more interested in why the value
> of DISPLAY was apparently changed by one su and not the other (or
> perhaps by both). The explanation, "probably with an alias for su",
> alias su="su -w DISPLAY", doesn't make any sense to me. Explanations?

"su" will leave the DISPLAY variable intact, and "su -" will remove it.
I can see no evidence to the contrary, regardless of whether I'm using
the ALWAYS_SET_PATH config variable.

The behavior is simple and consistent for me.

unicorn:~$ cat /etc/debian_version 
10.7
unicorn:~$ dpkg -S /bin/su
util-linux: /bin/su
unicorn:~$ dpkg -l util-linux | tail -n1
ii  util-linux     2.33.1-0.1   amd64        miscellaneous system utilities
unicorn:~$ cat /etc/default/su
ALWAYS_SET_PATH yes
unicorn:~$ echo "$DISPLAY"
:0
unicorn:~$ su
Password: 
root@unicorn:/home/greg# echo "$DISPLAY"
:0
root@unicorn:/home/greg# exit
exit
unicorn:~$ su -
Password: 
root@unicorn:~# echo "$DISPLAY"

root@unicorn:~# vi /etc/default/su
root@unicorn:~# cat /etc/default/su
# ALWAYS_SET_PATH yes
root@unicorn:~# logout
unicorn:~$ su
Password: 
root@unicorn:/home/greg# echo "$DISPLAY"
:0
root@unicorn:/home/greg# exit
unicorn:~$ su -
Password: 
root@unicorn:~# echo "$DISPLAY"

root@unicorn:~# 

If someone is seeing DIFFERENT behavior than this, they have yet to
demonstrate it for us.


Reply to: