Create User In Ubuntu

Create User In Ubuntu

Hey everyone, in today's blog, we will launch an EC2, create a new user, and perform some other operation. Let's go

Create an EC2 Instance

First, we will create an ec2 instance and then ssh into that instance.

Now SSH into that instance with the SSH command.

To Add

Create a new user

Now we are connected to the Server. Let's create new users name sourav

Switch to the other user

Let's switch the user sourav but before we do that let's check the current user name.

To Modify

These are the commands used to modify your user settings.

To modify the username of a user:

usermod -l new_username old_username

To change the password for a user:

sudo passwd username

To change the shell for a user:

sudo chsh username

To change the details for a user (for example real name):

sudo chfn username

To add a user to the sudo group:

adduser username sudo

or

usermod -aG sudo username

And, of course, see also: man adduser, man useradd, man userdel... and so on.

To Delete

To remove/delete a user, first you can use:

sudo userdel username

Then you may want to delete the home directory for the deleted user account :

sudo rm -r /home/username

Did you find this article valuable?

Support sourav's blogs by becoming a sponsor. Any amount is appreciated!