Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am adding a user using

useradd -d /home/testuser -m -g usergroup -s /bin/bash testuser

The group 'usergroup' already exists. This command runs fine and the user is created. However, when I try to use it to write to a folder that only has group write permission, it says permission denied. When I look in /etc/group , the user is not in the list of users that belong to 'usergroup'. Is there an extra step I am missing?


forgot to mention that when I add the user to /etc/group, he has the correct access.


uid=524(testuser) gid=524(usergroup) groups=524(usergroup)


drwxrwxr-x  site usergroup                                  /usr/local/test/
share|improve this question
If your primary group is usergroup you needn't be listed for that group in /etc/group. Please post the output of id (when you are testuser) and the output of ls -ldZ /path/to/folder – Mark Wagner Oct 22 '10 at 23:05
Show the permissions and ownership of the directory you're unable to write to. – Dennis Williamson Oct 22 '10 at 23:53
Are you using ACLs? What does getfacl /usr/local/test/ say? – Steven Monday Oct 23 '10 at 0:07
up vote 4 down vote accepted

To add a user to a group IN ADDITION to their "personal" group, you need to use the -G option. This is probably the option you want, otherwise that user's home directory will be

drwxr-xr-x 2 user usergroup

Unless, of course, you don't want the user to have any personal stuff at all. If you want the user to write files with the usergroup group when working on the shared directory, set the sgid bit on the directory (chmod g+s /usr/local/test/), this causes files created in that directory to always have the same group as the directory.

share|improve this answer
Using -G instead of -g worked, thanks. – shipmaster Oct 23 '10 at 1:02

Your Answer


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.