You are not logged in.

#1 2009-08-21 21:32:09

timm
Member
From: Wisconsin
Registered: 2004-02-25
Posts: 417

Who does a program "run as"? [Solved]

I'm working on installing a removable hard drive system to use with my bacula backup system.  I need to write an index to the drives, and to do that I'm supposed to use a command that includes the user that a bacula sub-program "runs as".

This is a question that I run into from time to time, and although I occasionally think I'm making progress in learning linux, I can never figure out what that means or how to determine the answer.

I do know that bacula has to start as root, but then it can drop down to another user.  If I try to run the command with the "drop down" user, it doesn't work, have to run it as root, which leads to other problems not relevant here.

The bottom line is, how do you find out who a program "runs as"?

Last edited by timm (2009-08-28 17:29:57)

Offline

#2 2009-08-21 21:47:16

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Who does a program "run as"? [Solved]

If you simply want to know what user a specific program is running under, use you can 'ps aux'. For instance, I'm running openbox right now:

ps aux | grep openbox
skottish  3422  0.0  0.0  88544  7572 tty1     S    14:04   0:00 /usr/bin/openbox
skottish  3742  0.0  0.0   8012   944 pts/0    R+   14:44   0:00 grep --color=always openbox

It's showing grep also because the above command is using grep. ps aux without arguments will show you all processes running, including programs, and the user that it's running under.

This will print only the first occurrence of the user name:

ps aux | grep openbox | awk '{print $1}' | awk 'NR < 2'

Of course now that this is posted, you should get even better answers from people that know more than I do.

Offline

Board footer

Powered by FluxBB