P
P
Pista2020-12-03 16:17:13
linux
Pista, 2020-12-03 16:17:13

How to login as nginx user?

I have php and nginx running as an nginx user, I usually work as root, but the scripts that I upload under root often don’t work, because I uploaded them and they have the root owner, but I need nginx, I have to manually change the owner of the files, you can Is it possible to somehow log in under the nginx user and upload from under it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2020-12-03
@Pista

To do this, you need to set the user to some normal shell in /etc/passwd. Then, in fact, you can go under it through su nginxor simply execute the desired command using su -c.

S
Sanes, 2020-12-03
@Sanes

I have php and nginx running as nginx user, I usually run as root

Scripts must be run as a normal user. Accordingly, the files must belong to him.
  • Loginsu username
  • Returnexit
  • Change owner recursivelychown -R username: /var/www/username

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question