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

Re: addendum, Re: One-user system.



On Thu, Feb 10, 2022 at 09:48:40PM -0700, Charles Curley wrote:
> Interesting. I routinely log in as my non-root user, charles, and then
> 'su -', which gets me a root shell. I can then run X programs just
> fine. So your comment above got me curious.
> 
> charles@jhegaala:~/Desktop$ su -
> Password: 
> 
> Today is Sweetmorn, the 41st of Chaos, 3188. Lies and slander, sire! 
> root@jhegaala:~# echo $XAUTHORITY 
> /home/charles/.Xauthority
> root@jhegaala:~# 
> 
> So I expect that something has already done the export for me, and it
> is unnecessary.

unicorn:~$ echo "$XAUTHORITY"
/home/greg/.Xauthority
unicorn:~$ su
Password: 
root@unicorn:/home/greg# echo "$XAUTHORITY"
/home/greg/.Xauthority
root@unicorn:/home/greg# 
exit
unicorn:~$ su -
Password: 
root@unicorn:~# echo "$XAUTHORITY"

root@unicorn:~# 
logout

That makes me curious about what has been done to your system, which
is clearly behaving differently from mine.  "su" with no arguments
preserves the environment, but "su -" establishes a new environment
and launches a login shell.  The XAUTHORITY variable should be lost,
but perhaps something in your shell profile(s) is recreating it.


Reply to: