LINUX USERS: making and breaking them

By | July 5, 2016

When logged in as root (system admin) you can create users using the useradd command along with the desired username like this:

# useradd alex007

A prompt would ask for the password of the root or admin user to ensure that its a privileged person that is trying to create a new user. After creating the user, you must also create the users initial password:

#passwd alex007

Then a prompt follow where you enter the password you want twice. If the password is not created for a new user the user would be unable to log into the system.

 

When a new user is created, an entry in the /etc/passwd for the user is created by Linux automatically. Check this by using;

# cat /etc/passwd

The system also creates a directory, labelled with the users username in the /home directory. Like in the case above when alex077 is created, the users home directory is /home/alex007 or check with this command;

# ls /home

 

Deleting users:

The command to delete users from the system is the userdel command.

# userdel alex007

This removes the users entry in the systems /etc/passwd file.

You could also use;

# userdel –r alex007

Using the r option removes all the users files and directories automatically or you have to manually delete the files yourself.

 

Happy Linux’NG!


NEVER MISS AN UPDATE



I agree to have my personal information transfered to MailChimp ( more information )

Join over 10,000 visitors to receive Open Source tips, trick, news, tutorials, programming and more.

We hate spam. Your email address will not be sold or shared with anyone else.

ALEXANDER OMOROKUNWA
MUST READ  Ubuntu Linux is everywhere and connecting everything

Tell us what you think

This site uses Akismet to reduce spam. Learn how your comment data is processed.