LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-15-2007, 08:23 AM   #1
Akhran
Member
 
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.

Thanks!
 
Old 04-15-2007, 09:07 AM   #2
PTrenholme
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, 09:12 AM   #3
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
Code:
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:

Code:
grep "^$(ps u -C apache2 | tail -1 | awk '{print $1}'):" /etc/passwd | cut -d: -f4
Hope this helps.
 
Old 04-15-2007, 09:35 AM   #4
pixellany
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
 
  


Reply


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 01:26 AM
Running a process during boot anegbi Linux - Software 3 11-30-2005 03:08 AM
Running process sonu1082 Linux - Software 2 11-25-2004 05:32 AM
Process not running LinuxRam Linux - Newbie 4 09-09-2004 12:45 AM
What are Session ID, Group ID, Process ID... yrraja Linux - General 4 10-26-2003 10:33 PM


All times are GMT -5. The time now is 02:54 AM.

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