Posts Tagged ‘usermod’

Ubuntu – Add existing user to existing group

January 12, 2012 Leave a comment

To add an existing user to an existing group just type:

$ sudo usermod -a -G existing_group existing_user

This is explained in this nice post, among other uses of useradd and usermod:

Categories: linux, ubuntu Tags: , , ,

Add a user in Ubuntu and change the UID and GID

August 31, 2011 Leave a comment

To add a user with a specified home folder:

$ sudo useradd -d /home/rosa -m <username>

With -d we set the home folder of the user and with -m we force the creation of that folder.

Then we can set the password for that user:

$ sudo passwd <username>

To change the UID of the user (starts with 1000, 1001, etc.):

$ sudo usermod -u 1002 -U <username>

And to change the GID of the group:

$ sudo groupmod -g 1002 <groupname>

Categories: ubuntu Tags: , , , ,