Saturday, November 24, 2012

How to Add and Remove Users with Terminal on Linux



On virtually all Linux distributions now there are choices to be made by simple GUI in order to perform many different tasks. Often, however, the old (and in my opinion essential) command line allows us to speed up the process without having to go for a thousand screens and study us hundreds of options. To demonstrate this today we will see the ease and convenience of adding a new user in the terminal and not with the GUI.

Add a User

First open a terminal and give the command to be created a new account (in the guide all the controls are related to the creation of user ” username “, replace this fictitious name with the one you want):
sudo useradd username
Let’s create a home directory for the dear username and assegnamogli a password:
sudo mkdir / home / username
sudo passwd username
Finally, we allow the user ownership of her home:
sudo chown username / home / username
sudo chgrp users / home / username
If you want, then you can assign administrator privileges to the account you just created with the following command:
sudo adduser username sudo

Remove a user

If the goal is to delete a user, the process is even easier, just give these two commands, respectively, delete the user and his home:
sudo rm-r / home / username /
That’s it, yes, that’s all. Beautiful terminal , right?

No comments:

Post a Comment