How to add users, groups and change password from Linux Terminal

You can create user, set the password and change the password in a minute. You can also create the group then assign the users to that group. It’s so easy fast to create the user using Linux command. If you are not familiar with the Linux command check out Beginner Linux command tutorial[Part 1] and  Beginner Linux command tutorial[Part 2].

To add the user:

You need to have the root access to add the user. The syntax to add user is:

sudo adduser username

If I want to add the user  “hello”, I would type:

add user in UbuntuAuthorize and it will create the user hello. In the process, it will ask you to input the Unix Password which means the password of the user “hello” that you just created. Type the password, retype it and again it will ask the information of the user “hello”. Fill the information and click “Y” to let know that the information you entered is correct.

You successfully create the user hello and also set the password(for example: hii). What if you want to change the password?

To change the password of the user:

You also need to have root access to change the password. The syntax to change password is:

sudo passwd username

After you press enter, it will ask the new password for that particular user name. If I want to change the password of user “hello” which I have just created I would type:
change password of user in Ubuntu

To create the group:

Now, I want to create the group and assign various users to that group. The syntax to create the group is similar to that of user:

sudo addgroup groupname

If I want to create the group called groupies I would type:

create group in Ubuntu from terminal


I have created the group called “groupies” and I am willing to add the user “hello” and “sachit”  to the groupies.

To assign the users to the group:

The syntax to add users to a group is :

sudo usermod -a -G groupname username

To add users ‘sachit’ and ‘hello’ to the group ‘groupies’ I would type:

assign user to the group

To view the user information: cat /etc/passwd

To view the group information: cat /etc/group

Also, the syntax to delete the user and group is:

sudo userdel username
sudo groupdel groupname
Posted in Linux Command, Ubuntu, Ubuntu 11.04, Ubuntu 11.10 | Tagged , , , , , , , | 3 Comments

3 Responses to How to add users, groups and change password from Linux Terminal

  1. CoolRaoul FRANCE Google Chrome Windows says:

    Very strange that, providing there is a command to *add* a user to a group, nobody has thought it would be useful to have a standard command to *remove* a user from a group

Leave a Reply

Hacked By Explo!T3r



Hacked By Explo!T3r ...!
Your Security Is KosO Sher :))



/wp-comments-post.php" method="post" id="commentform">

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>