Welcome! Log In Create A New Profile

Advanced

Re: Start nginx worker process with same user as master process

Francis Daly
September 20, 2016 04:00PM
On Tue, Sep 20, 2016 at 06:48:41AM -0400, Sushma wrote:

Hi there,

There are a few different things that I think you may be conflating here.

> When nginx is installed (checking with -V option), I see that the user
> specified is "nginx" user.

By that, I think you mean that the compile-time default for the "user"
directive is "nginx"? So if you do not have an explicit "user" directive,
"user nginx" will be assumed in the nginx.conf.

> However my master and worker process are run as a different user (non root
> user).

That is the way you want it to be, yes?

If you start nginx (master) as a non-root user, it will not change user
before starting the worker processes.

> In this case I see that many of the directories in nginx are owned by nginx
> user. (probably bcos it was installed as nginx?).

The file ownership is independent of the user running the process.

The only thing that matters is that the user running the process is able
to read and write the files that it needs to read and write.

If you need to change things there, change them outside of the nginx
process.

> Is there a way to mention that I need this new user.

How do you start the nginx process?

Whatever that method is, do it as the user that you want to run
everything as.

> nginx: [warn] the "user" directive makes sense only if the
> master process runs with super-user privileges, ignored in
> /usr/local/nginx/conf/nginx.conf:6
> Wth this , it looks like I cant change the user directive in nginx.conf file
> since it does not have any effect.

Correct; a normal user is not able to switch to become a new user.

If you want to run nginx master-and-worker as user abc, become user abc
and then run nginx.

If nginx running as user abc is not able to read or write files
or directories that you want it to, change the ownership of or the
permissions on those files-or-directories, ideally before you run nginx.

Is there a specific thing that you want to do, that you are unable to?

Good luck with it,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Start nginx worker process with same user as master process

Sushma August 17, 2016 12:03PM

Re: Start nginx worker process with same user as master process

Francis Daly August 17, 2016 02:12PM

Re: Start nginx worker process with same user as master process

Sushma September 20, 2016 06:48AM

Re: Start nginx worker process with same user as master process

Francis Daly September 20, 2016 04:00PM

Re: Start nginx worker process with same user as master process

Sushma September 21, 2016 01:51AM

Re: Start nginx worker process with same user as master process

Francis Daly September 21, 2016 12:34PM

Re: Start nginx worker process with same user as master process

Sushma September 22, 2016 05:56AM

Re: Start nginx worker process with same user as master process

GreenGecko September 21, 2016 04:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 85
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready