How to get original user (linux 2.4.20 kernel)

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

 



Hi,
   I am looking for some way to extract original user for a given
process. For example,
A user types following command

i   ) guest log's in as "aaa"
ii  ) su - "bbb"
iii ) su - "ccc"
iv ) ./a.out

I want to find the actual user i.e. "aaa". Can this be acheived on Linux 2.4.20?
I am thinking of following solution but don't know whether this will
work in all the cases or is there is any better way to achieve this.

struct task_struct {
...
pid_t session;  /* Stores login session pid */
...

}

This "session" is the pid of login session process. Using this pid we
can traverse task_struct and get "uid" associated with this pid and
hence original user.

Thanks in advance.

Regards,
Linux Dang

--
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