${LOGNAME} vs. ${USER}

silver.bullet at zoho.com silver.bullet at zoho.com
Thu Jul 30 13:41:46 UTC 2015


On Thu, 30 Jul 2015 04:19:44 -0700, Tom H wrote:
>On Thu, Jul 30, 2015 at 3:23 AM,  <silver.bullet at zoho.com> wrote:
>> I'm booted to Arch Linux at the moment, but it shouldn't differ
>> What you need for your usage, depends on what you want to achieve.
>>
>> Take a look at the differences, especial how it differs after running
>> sudo or su.
>>
>> $ echo $LOGNAME $USER $(id -un) $EUID $(id -u)
>> rocketmouse rocketmouse rocketmouse 1000 1000
>>
>> $ sudo -i
>> # echo $LOGNAME $USER $(id -un) $EUID $(id -u)
>> root root root 0 0
>>
>> $ su
>> # echo $LOGNAME $USER $(id -un) $EUID $(id -u)
>> rocketmouse rocketmouse root 0 0
>
>Sure, using su and sudo changes things but that's not what the OP was
>asking about - unless I misunderstood the question.

Btw. just setting up a root account for Ubuntu by passwd root, Ubuntu does
behave different than my Arch.

[weremouse at moonstudio ~]$ echo $LOGNAME $USER $(id -un) $EUID $(id -u)
weremouse weremouse weremouse 1000 1000

[weremouse at moonstudio ~]$ sudo -i 
[root at moonstudio ~]# echo $LOGNAME $USER $(id -un) $EUID $(id -u)
root root root 0 0

[weremouse at moonstudio ~]$ su
[root at moonstudio weremouse]# echo $LOGNAME $USER $(id -un) $EUID $(id -u)
root root root 0 0

Regards,
Ralf





More information about the ubuntu-users mailing list