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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-25-2010, 03:23 AM
|
#1
|
Member
Registered: Aug 2009
Posts: 539
Rep:
|
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'.
|
|
|
01-25-2010, 03:55 AM
|
#2
|
Member
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707
Rep:
|
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.
|
|
|
01-25-2010, 04:05 AM
|
#3
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
01-25-2010, 04:34 AM
|
#4
|
Member
Registered: Aug 2009
Posts: 539
Original Poster
Rep:
|
Quote:
Originally Posted by vinaytp
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.
|
01-25-2010, 05:51 AM
|
#5
|
Member
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707
Rep:
|
Quote:
Originally Posted by thomas2004ch
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...
|
|
|
01-25-2010, 06:20 AM
|
#6
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
All times are GMT -5. The time now is 10:11 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|