LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-04-2020, 09:02 AM   #1
JamesMore
LQ Newbie
 
Registered: Jul 2010
Posts: 23

Rep: Reputation: 0
Apache running as me


I have setup server with Apache (Centos 8) but it looks like I have Apache running under my user account.

Is that bad ? my account has access to sudo, Should I create another user and have it running as that user?

If so how do I do that, thanks for your help
 
Old 07-04-2020, 09:22 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 14,840

Rep: Reputation: 4878Reputation: 4878Reputation: 4878Reputation: 4878Reputation: 4878Reputation: 4878Reputation: 4878Reputation: 4878Reputation: 4878Reputation: 4878Reputation: 4878
yes, it is not the suggested configuration. I think you can specify the user in httpd.conf. Usually a user is created for this: www-data
 
Old 07-04-2020, 11:38 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 20,228

Rep: Reputation: 3460Reputation: 3460Reputation: 3460Reputation: 3460Reputation: 3460Reputation: 3460Reputation: 3460Reputation: 3460Reputation: 3460Reputation: 3460Reputation: 3460
How did you set up Apache? Did you install it from the repositories?

By default CentOS configures apache to run as user apache.

ps aux | egrep '(apache|httpd)'
 
1 members found this post helpful.
Old 07-05-2020, 10:02 AM   #4
JamesMore
LQ Newbie
 
Registered: Jul 2010
Posts: 23

Original Poster
Rep: Reputation: 0
Thank you both for the reply here is the output of PS, As you cans see it is showing root on one process and my username near the bottom of the list

Code:
[JamesMore@myServername ~]$ ps aux | egrep '(apache|httpd)'
apache       787  0.0  3.4 282304 28784 ?        S    Jul01   0:04 php-fpm: pool www
apache       788  0.0  3.3 282020 28240 ?        S    Jul01   0:02 php-fpm: pool www
apache       789  0.0  3.3 282032 28476 ?        S    Jul01   0:02 php-fpm: pool www
apache       790  0.0  3.3 282032 28212 ?        S    Jul01   0:02 php-fpm: pool www
apache       791  0.0  3.3 282020 28224 ?        S    Jul01   0:02 php-fpm: pool www
apache      5262  0.0  3.3 282020 28368 ?        S    Jul02   0:02 php-fpm: pool www
apache      5372  0.0  3.3 282172 28288 ?        S    Jul02   0:02 php-fpm: pool www
root       10120  0.0  1.6 280592 14000 ?        Ss   Jul03   0:15 /usr/sbin/httpd -DFOREGROUND
apache     14663  0.0  1.0 293668  9128 ?        S    03:37   0:00 /usr/sbin/httpd -DFOREGROUND
apache     14664  0.0  1.7 1482232 15000 ?       Sl   03:37   0:10 /usr/sbin/httpd -DFOREGROUND
apache     14665  0.0  1.7 1351096 14980 ?       Sl   03:37   0:09 /usr/sbin/httpd -DFOREGROUND
apache     14666  0.0  1.9 1351096 16628 ?       Sl   03:37   0:09 /usr/sbin/httpd -DFOREGROUND
apache     15327  0.0  1.7 1351096 14788 ?       Sl   13:11   0:01 /usr/sbin/httpd -DFOREGROUND
JamesMore     15475  0.0  0.1  12108  1064 pts/1    R+   14:57   0:00 grep -E --color=auto (apache|httpd)

Last edited by JamesMore; 07-06-2020 at 05:11 PM. Reason: Code block
 
Old 07-05-2020, 10:27 AM   #5
JamesMore
LQ Newbie
 
Registered: Jul 2010
Posts: 23

Original Poster
Rep: Reputation: 0
Sorry tweaked the PS output to not show my user name (This might have made me think my user was running apache)

Does this look ok from my limited knowledge apache is stated as root and then the child processes are ran as the user apache

Code:
[JamesMore@myServername httpd]$ ps aux | egrep --color '([a|A]pache|[h|H]ttpd)'
apache       787  0.0  3.4 282304 28784 ?        S    Jul01   0:04 php-fpm: pool www
apache       788  0.0  3.3 282020 28240 ?        S    Jul01   0:02 php-fpm: pool www
apache       789  0.0  3.3 282032 28476 ?        S    Jul01   0:02 php-fpm: pool www
apache       790  0.0  3.3 282032 28212 ?        S    Jul01   0:02 php-fpm: pool www
apache       791  0.0  3.3 282020 28224 ?        S    Jul01   0:02 php-fpm: pool www
apache      5262  0.0  3.3 282020 28368 ?        S    Jul02   0:02 php-fpm: pool www
apache      5372  0.0  3.3 282172 28288 ?        S    Jul02   0:02 php-fpm: pool www
root       10120  0.0  1.6 280592 14000 ?        Ss   Jul03   0:15 /usr/sbin/httpd -DFOREGROUND
apache     14663  0.0  1.0 293668  9128 ?        S    03:37   0:00 /usr/sbin/httpd -DFOREGROUND
apache     14664  0.0  1.7 1482232 15000 ?       Sl   03:37   0:10 /usr/sbin/httpd -DFOREGROUND
apache     14665  0.0  1.7 1351096 14980 ?       Sl   03:37   0:10 /usr/sbin/httpd -DFOREGROUND
apache     14666  0.0  1.9 1351096 16628 ?       Sl   03:37   0:10 /usr/sbin/httpd -DFOREGROUND
apache     15327  0.0  1.7 1351096 14788 ?       Sl   13:11   0:01 /usr/sbin/httpd -DFOREGROUND

Last edited by JamesMore; 07-06-2020 at 05:12 PM.
 
Old 07-05-2020, 01:59 PM   #6
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.8.2003
Posts: 4,956

Rep: Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830
The user running the web server (httpd) is apache.
The line with your username in #4 is the grep command...has nothing to do with httpd. It matches your grep....(doh)

Your conclusion in #5 is correct.

Please use code tags when posting output. See the link in my signature.
 
1 members found this post helpful.
Old 07-12-2020, 03:10 PM   #7
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: Currently: openSUSE, Raspbian, Slackware. Formerly: CentOS, MacOS, Red Hat. Other: Solaris, Tru64
Posts: 1,980

Rep: Reputation: 325Reputation: 325Reputation: 325Reputation: 325
Quote:
Originally Posted by JamesMore View Post
Sorry tweaked the PS output to not show my user name (This might have made me think my user was running apache)
It had ya goin' there for a minute, didn't it. [heh]

I found it handy to search ps output using:
Code:
$ ps -ef | grep something | wogrep
where "wogrep" (WithOut GREP) is an alias:
Code:
$ alias wogrep='grep -v grep'    # Put it $HOME/aliases and source it in your profile
That way if you're counting (or whatever) processes your grep doesn't affect the result.

HTH...
 
1 members found this post helpful.
Old 07-12-2020, 03:50 PM   #8
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 1,142

Rep: Reputation: Disabled
I usually just enclose the first character in square brackets similar to what the OP did in #5.
Code:
ps -ef | grep [s]omething
BTW, trying to run httpd on CentOS as any other user than apache would probably fail because of wrong SELinux context.
 
1 members found this post helpful.
Old 07-12-2020, 08:50 PM   #9
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.8.2003
Posts: 4,956

Rep: Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830
Quote:
Originally Posted by shruggy View Post
I usually just enclose the first character in square brackets similar to what the OP did in #5.
Code:
ps -ef | grep [s]omething
BTW, trying to run httpd on CentOS as any other user than apache would probably fail because of wrong SELinux context.
On my server, the http user is nobody...but I’ve been moving this setup through upgrades since (I think) RH 3...around 1999.
Still, your point is valid...one shouldn’t mess with what the out-of-the-box installation wants to do.
 
  


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
Newbie with Apache Server question "ervice - The Apache HTTP Server" vs. "Service - The Apache HTTP Server" HYEARWOOD Linux - Newbie 5 10-17-2017 02:38 AM
Apache with nobody:nobody and apache:apache sudhirmhrj Linux - Server 1 06-29-2010 04:48 AM
Failed to start apache : Apache does not appear to be running : number11 Slackware 9 02-11-2005 09:51 AM
apache benchmarks (apache v13 / apache v20) ; large differences between benchmarking markus1982 Linux - Software 0 02-08-2003 10:53 AM
running samba worked, running it out of xinetd doesn't? system Linux - Networking 1 12-24-2001 03:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:57 PM.

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
Open Source Consulting | Domain Registration