Search tutorial by keyword

How to add/ remove users/groups in Linux

 

 

While working on Linux you need users other than root as it’s the main user and you don’t want to risk security by giving everyone the password of root so you have to add users and sometimes groups and add users to the groups to get a defined picture of your office. In this post we will see that how can we add or remove users or groups in Linux

 

To add a user 

 

#useradd michael

 

#passwd michael

 

Since it’s a powerful command it comes with various options. Everytime you add a user it is given a folder in home with the username so that he can use the folder for saving data but if you want the user to have some other directory other than home then you can use the following command

 

#useradd –d /tmp/michael

 

If you want a user but no directory allocated to him then you should use following command

 

#useradd –M michael

 

To create a group you need to use the following command

 

#groupadd IT

 

This will make a group named “IT”

 

If you want to add a user to this group you can use this command

 

#usermod –a –G IT michael

 

This will add michael to IT

 

Now to delete users and groups you have to use the following command

 

#userdel michael

 

If you want to delete the data and directory assigned to the user then use the following command

 

#userdel –r michael

 

To delete a group use the following command

 

#groupdel IT

Last modified onViernes, 03 Abril 2015 16:16
Michael Dudli

Cloud Specialist with more than 10 years experience in the Hosting Business.

Website: www.cloudserver24.com

Contact

Ventas

sales@cloudserver24.com

Soporte

support@cloudserver24.com