Skip to main content

How to add user in Ubuntu Lniux

Ubuntu-logo.png

At some point in your Ubuntu Linux server or desktop administration journey, you will need to create a user.
Usually, we create users in the servers for administration on more than one person or a service account that
needs to be created in order for the service to only run as that user. This creates a security barrier in the services you run.
Here we have steps on how to complete this function. Follow the instructions and if you encounter an error, please email support.

This tutorial assumes that:
You know the IP address of the machine intended for changes, and
can Login the machine with Telnet, Serial or, SSH

Note:
Only "sudo" can create a user, So, the first thing we have to do is check if the user you login with is a "sudo". 
Check with the command sudo -l 

 

1. Check "sudo" privileges by running sudo -l


code:

mslsadmin@remote01:~$ sudo -l
[sudo] password for mslsadmin:
Matching Defaults entries for mslsadmin on remote01:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty

User mslsadmin may run the following commands on remote01:
    (ALL : ALL) ALL
mslsadmin@remote01:~$

2. Use the sudo adduser  command to add the new user and follow the prompt:

code:

mslsadmin@remote01:~$ sudo adduser test
Adding user `test' ...
Adding new group `test' (1001) ...
Adding new user `test' (1001) with group `test' ...
Creating home directory `/home/test' ...
Copying files from `/etc/skel' ...



3. Continue the prompt and create a password for the new user :

code:

New password: ****
Retype new password:*******
passwd: password updated successfully
Changing the user information for test

note:
While entering the password you might not see that keys are actually being entered. This is completely normal and may differ from other Linux distributions or console applications.


4. Next the adduser prompt will ask you for more information about the user,  Enter relevant information or, if you want to skip the prompt, leave the options blank and press ENTER. 

code:

Changing the user information for test
Enter the new value, or press ENTER for the default
        Full Name []: Test User
        Room Number []:
        Work Phone []:
        Home Phone []: d
        Other []:

5. Confirm your changes and choose "Y" 

code:

Is the information correct? [Y/n] Y

Congratulations! You successfully created an user in Ubuntu Linux