You are not logged in.
When I su into root from whatever user, echo $USER gives not "root" but the username I was su-ing from.
For example:
[john@HomeC ~]$ echo $USER
john
[john@HomeC ~]$ su mark
Password:
[mark@HomeC john]$ echo $USER
mark
[mark@HomeC john]$ su
Password:
[root@HomeC john]# echo $USER
mark
[root@HomeC john]# exit
[mark@HomeC john]$ exit
[john@HomeC ~]$ su
Password:
[root@HomeC john]# echo $USER
john
Can you help me please to track down what the problem is.
Last edited by SanskritFritz (2014-11-21 15:21:30)
zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)
Offline
That is along the same lines as when you su into root and try to "steal" the X credentials. Some applications will not run in some window managers/desktop environments unless the keyring is also transferred.
I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.
Offline
So the default behaviour of normal users is to set that variable but root is an exception for this?
zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)
Offline
Your confusion is caused by your assumptions of who sets that variable. Its not the shell.
Oh I see. Sadly I can't find the snippet where it is set. Not .bashrc, nor .bash_profile sets it. With the risk of being a help vampire, can you tell me how $USER is set?
Last edited by SanskritFritz (2014-11-21 14:39:38)
zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)
Offline
Ah, found it: /etc/bash.bashrc
UPDATE: no, that's not it either.
Last edited by SanskritFritz (2014-11-21 14:42:31)
zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)
Offline
It's the login program which does this in the case of a normal login:
https://github.com/karelzak/util-linux/ … in.c#L1048
If you tell su to create a new login session (as you should always do if you insist on using su. pro tip: you shouldn't, it's bad, use sudo or runuser), then su will set it:
Offline
Thank you guys.
zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)
Offline
pro tip: you shouldn't, it's bad, use sudo or runuser
Learning something new everyday Thanks.
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline