User and Group Management

linux-penguinGetting to grips with the command line in Linux will mean that you'll always be able to manage practically any Linux distribution (and there are literally hundreds) without having to learn a new interface. Command line instructions are often quicker to implement as well.


You will typically need to create some groups first before you can add users to them.

$ sudo addgroup <groupname>

To display a list of the members of a group type...

$ sudo getent group <groupname>



To see a list of exising users you can type...

$ cat /etc/passwd

Alternatively to see when users last logged in type...

$ lastlog


To add a new user, type the following...

$ sudo adduser <username>

 You will be prompted to enter and confirm the user password, and other contact information.


To add or remove a user to a group use one of the following commands.

$ sudo adduser <username> <groupname>
$ sudo deluser <username> <groupname>

By default a user is primarily a member of a group with the same name as the user.  You can change this primary group with the following command.

$ sudo usermod -g <groupname> <username>


Resetting Passwords

To reset a user's password, enter the following

$ sudo passwd <username>


Thanks for visiting.