Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
1  
You will also want to give them x perms on directories. –  jordanm Jan 22 at 4:41

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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