How to add user from apache user group in linux

16,658
 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

Share:
16,658

Related videos on Youtube

Osman Ercelik
Author by

Osman Ercelik

Updated on September 18, 2022

Comments

  • Osman Ercelik
    Osman Ercelik over 1 year

    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?

    • muru
      muru over 9 years
      You can't. Only the administrator may change groups (or grant permission to change groups via sudo).
    • Aaron D
      Aaron D over 9 years
      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
      Aaron D over 9 years
      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.