Re: How to get original user (linux 2.4.20 kernel)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/5/06, Dang <linuxdang@xxxxxxxxx> wrote:
Hi Jesper, thanks for the quick reply.
Answer to your questions:

Q1 Why?
I am doing some project where in we have a requirement for logging
current user as well as the actual user (who logged into the system).
From security point of view such information mke sense.


IMO its really make sense :)

Q2 If you could do that, then "su" would kind of loose its meaning...
IMO "su" provides us the functionality to switch between different
users i.e. different access levels. Moreover "su" does not mean that
information about the previous user is lost; remember when we type
"exit" it takes us to previous user.


I think Jesper by saying "If you could do that, then "su" would kind
of loose its meaning..." means that if you changed the user (or user
id) from su to original user then su will become useless, but
obviously previous user information won't lost when you do su as you
mentioned too !

One interesting thing that i came across few minutes back. There are
two command "whoami" and "who am i".
Try following sequence of commands:
i   ) Login as "root"
ii  ) su - aaa
iii ) whoami  /* This will output aaa */
iv ) who am i /* This will output root */
So it seems there is some way.


You can take a look at "who" source, because "who" can give many
information and you can use "who -m" at the place of "who am i" and
will get same result. So, consult who source and man page for getting
idea of how to get the previous user information. :)

--
Fawad Lateef

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux