0

Could anyone please help to find a way to create a process whose ruser and user are different? Currently, I used the line sudo su david -c ./test.pl, Then when I type the following line to get the user and ruser:

% ps -eo pid,user,ruser,fname,pcpu,nice,stime,time | grep test.pl
10322 david david test.pl 12.4 20 13:37:00 01:38

The user and ruser are still the same. I need to create a process like the following sample:

% ps -o user,ruser,comm -p 59515
...
USER    RUSER COMMAND
root csrethab xscreensaver 

Any thoughts?

1
  • Can you explain a little about why you need user and ruser to be different? I cannot find much about ruser and I have not used it before, so it is possible that the problem you are trying to solve using ruser can be solved in some other ways. Mar 7, 2013 at 2:51

2 Answers 2

0

Instead of doing sudo su david to run the process, change the mode of program to allow setuid:

chmod u+s /path/to/program (this must be done as a user who is allow to chmod the program, e.g. root)

Then just run the program without using sudo. It will have the effective user david but the ruser will be you.

0
2

The difference is pretty minor, and mainly comes into play with things like suid processes.

For instance, something like passwd, as a non-privileged user, you have the ability to modify a file, that only a uid of 0 has. So your effective user, or user would be root, and your ruser the actual user would be david.

So for a process that has a setuid root, ie. passwd, you will have a distinction.

You should be able to see a difference, by having the file be setuid to a user different than the one running.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .