Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-10-2012, 05:53 PM   #1
LQ Newbie
Registered: Sep 2009
Posts: 10

Rep: Reputation: 0
If I su to a user, how can I tell who the base user is?

After logging in to a box as a user(1), I then su to another user(2), is there a command I can execute as user (2) to see who the base user(1) is?
Old 02-10-2012, 06:07 PM   #2
LQ Guru
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2
Posts: 5,163

Rep: Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522
The 'who' command will show you the "base user".
Old 02-10-2012, 08:06 PM   #3
Senior Member
Registered: Dec 2011
Location: Michigan USA
Distribution: OpenSUSE 13.2 64bit-Gnome on ASUS U52F
Posts: 1,444

Rep: Reputation: 340Reputation: 340Reputation: 340Reputation: 340
if you type whoami the reply from terminal will be the userID in which you are logged in.

Good luck to you.
Old 02-10-2012, 09:37 PM   #4
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
If the - option of su has been used (su - newuser, rather than su newuser) then the only way AFAIK is to parse ps fau output.
Old 02-12-2012, 06:40 PM   #5
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,396

Rep: Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395
# show curr user


# show 'prev' user
who am i
note the spaces in 2nd cmd
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to allow each user can create its own data base? px87 Linux - Server 2 02-07-2012 11:11 PM
Array size base on user input ICO Programming 1 10-27-2010 01:40 PM
Configuring Zimbra mail server with MS AD user base using LDAP Lantzvillian Linux - Security 1 11-26-2007 01:35 PM
LXer: Microsoft aims to double user base with $3 Windows and Office LXer Syndicated Linux News 0 04-19-2007 11:32 AM
User Mode Linux: Possible to get FC2 running on Debian base? neocookie Linux - General 0 11-15-2005 03:50 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:16 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration