How To Add and Delete User on Ubuntu From Shell – POFTUT

How To Add and Delete User on Ubuntu From Shell

Linux users can be added with different ways. but one of the most used way is adding them throughout the shell because Linux admins loves shell usage. In this tutorial we will look how to add user into a Ubuntu, Kali, Mint, Debian box and provide or change required parameters. We will also look user deletion.

Root Privileges

In order to add or remove user from a Linux box we need root privileges. We can get root privileges with different ways. We can login to root account like below.

OR we can use sudo  command which operates given command with the current user but with root privileges.

Add User with adduser

We can use adduser  command in order to add user.  We will add user named poftut . This command will ask user detailes step by step. At the end of the process we will accept adding given user with Yes\no question.

Add User with adduser 

Add User with adduser  

Add User with useradd

useradd is the fastest way to add user. useradd will not look for any user detail. Just add user to the Linux box. But it will not configure any password for the given user so we should set recently added user password with passwd like below. In this test we will add user named test1 and change its password.

Add User with useradd

Add User with useradd

Delete User

We can easily delete existing user with userdel  command. In the following example we will delete user named test1 . We need root privileges again.

LEARN MORE  Cockpit Easy and Web Based Administration of Linux

echo '

1 Response

  1. 20/09/2019

    […] can use the same script in order to remove files with extension tmp from /tmp directory with the following script. As a week is 7 days we can […]

Leave a Reply

Your email address will not be published. Required fields are marked *