[xubuntu-users] Detecting login name after su

Jan Henke Jan.Henke at taujhe.de
Fri Oct 4 07:34:33 UTC 2013


the command 'w' lists all currently logged in users together with the
source of the login. You can parse that output to look for you local
machine (IP address or reverse DNS name), then you have the user name.


Am 04.10.2013 00:57, schrieb Peter Flynn:
> On 10/03/2013 08:58 PM, Lutz Andersohn wrote:
>> I think the users command always prints the original user. I logged on as some 
>> user, did a sudo -i, called users again and it gave me my original user name. 
>> also works with sudo su -
> Indeed it does, thanks. But with potentially many users logged in, how
> do I detect which one is the account I "came from"?
> ///Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x20C88DFB.asc
Type: application/pgp-keys
Size: 9265 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/xubuntu-users/attachments/20131004/e17aae6a/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/xubuntu-users/attachments/20131004/e17aae6a/attachment.sig>

More information about the xubuntu-users mailing list