LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-25-2010, 03:23 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Rep: Reputation: 33
A question about user level


I login first with user1, and then log into user3 with 'su', and then to user2 and so on. I can use 'who' to know who is the first user. And using 'whoami' to know who is the current user. But how can I know the user level? Because sometimes I want to change back to the former user by using 'exit', not again using 'su'.
 
Old 01-25-2010, 03:55 AM   #2
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
Hi thomas2004ch...

what do you mean by user levels ? If you are lookig for user logins, here are few points...

Using su, I don't know how to see the user logins
Code:
[vinay@vinay ~]$ who
vinay    tty7         2010-01-25 10:06 (:0)
vinay    pts/0        2010-01-25 10:06 (:0.0)
vinay    pts/1        2010-01-25 10:31 (:0.0)
vinay    pts/3        2010-01-25 14:06 (:0.0)
[vinay@vinay ~]$ su -l vijay
Password: 
[vijay@vinay ~]$ su -l gaurav
Password: 
[gaurav@vinay ~]$ who
vinay    tty7         2010-01-25 10:06 (:0)
vinay    pts/0        2010-01-25 10:06 (:0.0)
vinay    pts/1        2010-01-25 10:31 (:0.0)
vinay    pts/3        2010-01-25 14:06 (:0.0)
[gaurav@vinay ~]$
Above in the output of who command, I can't find vijay and gaurav logins

But your goal can be achieved by ssh login

Code:
[vinay@vinay ~]$ ssh vijay@localhost
vijay@localhost's password: 
[vijay@vinay ~]$ ssh gaurav@localhost
gaurav@localhost's password: 
[gaurav@vinay ~]$ who
vinay    tty7         2010-01-25 10:06 (:0)
vinay    pts/0        2010-01-25 10:06 (:0.0)
vinay    pts/1        2010-01-25 10:31 (:0.0)
vijay    pts/2        2010-01-25 15:23 (localhost.localdomain)
vinay    pts/3        2010-01-25 14:06 (:0.0)
gaurav   pts/4        2010-01-25 15:23 (localhost.localdomain)
[gaurav@vinay ~]$

Last edited by vinaytp; 01-25-2010 at 04:02 AM.
 
Old 01-25-2010, 04:05 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I don't know what you mean by user level. You can run "pstree -u" to clearly see a tree of child and parent processes including the user.
Code:
pstree -u | grep -B2 -A4 bob
     |-knotify4
     |-knotify4(jschiwal)---4*[{knotify4}]
     |-konsole(jschiwal)-+-bash---su(root)---bash(bob)-+-grep
     |                   |                             `-pstree
     |                   |-bash
     |                   `-{konsole}
The "who" and "w" programs show logins. The user you su'ed to didn't log in.

Last edited by jschiwal; 01-25-2010 at 04:12 AM.
 
Old 01-25-2010, 04:34 AM   #4
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by vinaytp View Post
Hi thomas2004ch...

what do you mean by user levels ? If you are lookig for user logins, here are few points...
You understand right. What "user level" I mean is the user logins. From your writing I understood that using 'su' one can't see the user logins but using 'ssh', right?
 
0 members found this post helpful.
Old 01-25-2010, 05:51 AM   #5
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
Quote:
Originally Posted by thomas2004ch View Post
You understand right. What "user level" I mean is the user logins. From your writing I understood that using 'su' one can't see the user logins but using 'ssh', right?
Yes Thomas2004ch,

If you come to kno, please let us kno...
 
Old 01-25-2010, 06:20 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
SU'ing to a user, you are still the person who logged in. There is a UID and an EUID. Using su, your EUID (effective user ID changes). If the real person you su'ed to is logged in, w and who will show that login as well as others.

Using su is logged in /var/log/messages. Using sudo is better because every command is logged.
 
  


Reply


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
accessing SPI from kernel level and user level ramya_ts Programming 1 01-06-2009 07:30 AM
Question about Linux level 1/Level 2 jobs inara72 Linux - Newbie 2 04-09-2008 08:14 PM
emacs in run level 3 then switch to X (level 7) then back to level 3 dsoliver Slackware 3 09-01-2006 03:31 AM
scanner under user level ohcarol Linux - Hardware 1 11-29-2005 03:58 PM
code in user level ramu_ak Linux - Networking 0 08-21-2003 01:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:09 AM.

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