65

I am new to ubuntu server. How can I create a group lets call that group 'mypeople' then add a user to 'mypeople' lets use user 'brad'.

and have 'brad' only access to /var/www/brad/. 'brad' can write,read,execute in his directory and have shell access.

2 Answers 2

93

Creating a group

sudo addgroup groupname

Adding an existing user into this group

sudo adduser username groupname

Permissions Restriction

See this thread for permissions.

3
  • 4
    I got a adduser: The user `username` does not exist. output. Jul 4, 2018 at 20:48
  • You need to have the user created before adding to a group. Usee adduser 'username' first Jul 23, 2019 at 9:40
  • Just in case, groupname must be in lowercase May 22, 2020 at 2:23
5

**Creating a group **

we can add the group as below, and also you need to add the group id also.

eg - group name - fpsalph,group id - 10000

groupadd -g 10000 fpsalpha

after that, you can check it by this command.

tail /etc/group

You must log in to answer this question.

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