Linux Users

 

su

The su command allows you to run a shell as another user.

su {username}

su root

 

useradd

useradd commands you can add a user.

useradd -m -d /home/<userName> -c “<userName>” <userName>

useradd -m -d /home/lisa -c "lisa" lisa

 

userdel

To delete a user account userdel command is used. By using userdel -r option, you can delete home directory along with user account.

userdel -r {username}

userdel -r lisa

 

usermod

The command usermod is used to modify the properties of an existing user.

usermod -c <‘newName’> <oldName>  

usermod -c 'lisa' lisak

 

You can change the shell mode with usermod command for a user.

usermod -s <newShell> <userName>  

usermod -s /bin/bash lisak

 

passwd

A user can set the password with the command passwd. Old password has to be typed twice before entering the new one.

passwd {username}

// change current user password
passwd

// change another user password
passwd {username}

 

 

whoami

It tells you about the system’s username.

whoami

 

who

The who command gives the information about the users logged on to the system.

who

 

w

This command tells about the users who are logged in and what are they doing.

w

 

Groups

Users can be listed in different groups. Group allow us to set permission on the group level instead of setting the permission on individual level.

 

groupadd

The groupadd command creates or add a group in our system.

// create a group named developers
groupadd developers

 

group

The group command tells about the group where current user belongs to.

 

groupmod

With the help of groupmod command you can change the name of an already existing group.

groupmod -n <oldGroup> <newGroup>  

groupmod -n developers devs

groupdel

The command groupdel will delete a group permanently from the system.

groupdel developers

 

 




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

Your email address will not be published.