0

I am trying to form a group with two users so that only those two users have access to a directory using

chmod g+r dir

I form a new group, www-OtagoHarbour, and try to add an existing user, OtagoHarbour, like this.

OtagoHarbour@WebServer:/var/www/executables$ sudo groupadd www-OtagoHarbour
OtagoHarbour@WebServer:/var/www/executables$ sudo useradd -G www-OtagoHarbour OtagoHarbour
useradd: user 'OtagoHarbour' already exists
OtagoHarbour@WebServer:/var/www/executables$ sudo useradd -g www-OtagoHarbour OtagoHarbour
useradd: user 'OtagoHarbour' already exists

Of course the user 'OtagoHarbour' exists but I want to add it to a group with another user.

  • 1
    You will also want to give them x perms on directories. – jordanm Jan 22 '14 at 4:41
3

You use the command useradd to add accounts. But once they've been created you use the command usermod to modify them.

$ usermod -a -G www-OtagoHarbour OtagoHarbour

References

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.