4

I am sort of new in linux ubuntu. I tried to deploy a Django app using Nginx.

Do i need to create www-data user in my linux? Or does it already exist?

2
  • 1
    You can check for the existence of the www-data user in a terminal with id www-data. Oct 9, 2018 at 22:25
  • can someone please show how to create this user Jul 4, 2023 at 12:25

1 Answer 1

8

If you installed nginx from the standard Ubuntu repos, the installation should have created both the www-data user and group. Anyway the command to check if a specific user exists is (www-data example):

grep www-data /etc/passwd

or group:

grep www-data /etc/group

If you want to be part of that group you should do this:

sudo usermod -a -G groupName userName

obviously userName is your login name. Then logout and login again, and check with:

groups

if www-data appears, you are part of that group.

3
  • No need to cat into grep, just grep www-data /etc/passwd is enough. That said, usually you cannot become www-data, as for security reason has /usr/sbin/nologin as a shell. Oct 10, 2018 at 11:29
  • Yeah, deleted sudo su www-data from my answer ... seems that I have much more things to learn than to teach... :-(
    – ciampix
    Oct 10, 2018 at 13:06
  • 7
    I install openresty nginx fork it's looks didn't add www-data user group , your answer didn't show how to create this user !
    – Salem F
    Feb 12, 2019 at 19:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .