Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 having this strange problem. I am using usermod to add an existing user to another group. I want to create a new user and add an old user to this new user's group. To do this, I am doing the following things

Create a new user, -m creates the home directory for the user and -U creates a group by the same name, as that of the user.

useradd -U -m newuser

Then I add the old user to the new user's group as

usermod -a -G newuser olduser

-a appends this group to the already existing groups and -G is used to give the group name.

Now when I do groups olduser I get the following out put olduser newuser, but being the olduser I am unable to create a any file in the newuser home directory. I have set the proper directory permissions, the read, write and execute bit is set for group.

However if, instead of using usermod I manually edit the /etc/group file, and add newuser,olduser in front of the newuser group then everything works correctly. Is there a bug in usermod or I am doing something wrong.

share|improve this question

Have you tried doing this with adduser instead? The Ubuntu Help page recommends not using useradd. I think what your trying to do could be done like this:

adduser newuser (automatically makes home folder)

adduser newuser olduser (this adds newuser to the olduser group)

Hope that helps.


This should at least help you figure out if the problem is related to usermod or not. Try to add the user and change groups without using useradd or usermod.

share|improve this answer
Actually as I said in the question, the problem is not of adding a new user, that is working fine. The problem is of adding an existing user to the new user's group. I tried adding the old user to the new user created using adduser but the problem persists – Sachin Jun 15 '12 at 6:51
adduser user group adds user to group per adduser(1) – Michael Wild Jun 15 '12 at 7:54

It is likely that you just need to logout and login again to let the new permission to become effective.

share|improve this answer

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.