Alfredo Cole writes:
I have a program that must be run as root, to access directly the parallel port of my server. This is done using sudo. When I try to see who is running the program, ps or top show that user root is running it. Is there a way I can find the real user who called sudo to run that particular instance of the program?
Probably a better solution would be to change the permissions of your parallel port device to be readable/writable only by a special group ("parport" or somesuch), and then make the program that accesses the parallel port sgid. This would allow you to see the real user running the program via "ps", and is generally a more secure way to do this sort of thing anyway. E.g., add the following line to your /etc/group: parport:!:50 Then, set the permissions of your parallel port device: root$ chgrp parport /dev/parport0 root$ ls -l /dev/parport0 crw-rw---- 1 root parport 99, 0 2004-04-06 06:27 /dev/parport0 Finally, make your program sgid parport: root$ chgrp parport /usr/bin/your_program root$ chmod 2755 /usr/bin/your_program root$ ls -l /usr/bin/yourprogram -r-xr-sr-x 1 root parport 63080 2004-04-05 18:06 your_program Note the sgid "s" bit in the group permissions. -Ti