Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-15-2007, 09:23 AM   #1
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Rep: Reputation: 30
Is there a way to know what is the group a process is running as?

Eg. if I have a process apache2 running as a daemon, is there a way to know what is the group the process is running as?

'ps aux' only show the user ID the process is running as.

Old 04-15-2007, 10:07 AM   #2
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Try ps -eopid,user or some variant. See man ps for all the options. (The command I suggested lists all processes, not a specific one.)
Old 04-15-2007, 10:12 AM   #3
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
export PROCESS_NUMBER=999    # or whatever the process number is
grep "^$(ps u $PROCESS_NUMBER | tail -1 | awk '{print $1}'):" /etc/passwd | cut -d: -f4
or, if the process is running a program called apache2, and you know that there's only one process running apache2:

grep "^$(ps u -C apache2 | tail -1 | awk '{print $1}'):" /etc/passwd | cut -d: -f4
Hope this helps.
Old 04-15-2007, 10:35 AM   #4
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
A process does not "run as" a user, group, etc. Processes have owners, who in turn belong to groups. A user can start a process, but a group cannot.

ps -u fred gives you all the processes owned by fred
ps -g users gives you all the processes owned by members of the "users" group


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to know the foreground process group ID of another console ?? sreeramabsc Linux - General 0 01-30-2006 02:26 AM
Running a process during boot anegbi Linux - Software 3 11-30-2005 04:08 AM
Running process sonu1082 Linux - Software 2 11-25-2004 06:32 AM
Process not running LinuxRam Linux - Newbie 4 09-09-2004 01:45 AM
What are Session ID, Group ID, Process ID... yrraja Linux - General 4 10-26-2003 11:33 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:43 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration