The question is simple. How we can add user without root privileges (because www-data is very important for security)?

For example adding user with root user:

sudo adduser user group

Without root privileges and user, with www-data, how can we do this?

  • You can't. Only the administrator may change groups (or grant permission to change groups via sudo).
    – muru
    Commented Jan 6, 2015 at 19:31
  • Your question is ambiguously phrased. Do you mean adding a user with permission to access www-data's files, or (as I suspect), giving www-data the permission to create and add new users to the system (e.g. a web signup form that creates a system user and mailbox etc.)?
    – Aaron D
    Commented Jan 7, 2015 at 1:33
  • If it's the latter, you need to provide sudo access to the www-data user on a non-TTY login, which is very dangerous as it opens a security hole for an attacker to compromise your system remotely by exploiting a bug in your CGI code. However, the information to do it is here.
    – Aaron D
    Commented Jan 7, 2015 at 1:36

1 Answer 1

 sudo adduser username

 sudo adduser username www-data

First command creates user and will create a home directory for user and add them to group (whatever username is), second gives group access to www-data to said user.

If user already exists, just use the second command. If user is logged in at time they will need to log out and in again for change to take

You must log in to answer this question.

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