Linux provides a multi-user system in which more than one person can interact with the same system at the same time. You have the responsibility, as a system administrator to manage the system’s users and groups by creating and removing users and assign them to different groups.
In Linux distribution, you can easily create a user account and assign the user to different groups using the useradd command. useraddis a low-level utility, Debian and Ubuntu users will use the friendlier adduser command instead.
useradd Command
Basic syntax for creating a user is as follows:
sudo adduser vetechno
In the above command “vetechno” is my username you can replace it if needed.
useradd command will create a new user in Linux system which has filelocation is /etc/default/useradd file
Now the user is created in Linux, now you have to set password. To do that run the passwd command followed by the username:
sudo passwd vetechno
Output:-
Add in sudo group
Another method is to create a new user is given below:-
sudo adduser –force-badname <username or first_name.(dot)last_name>
Now if you want to add user to sudo group then run the following command
sudo usermod -aG sudo <username>
OR
sudo adduser <username> sudo
OR
In this example, we are adding the user to sudo group through the following command:-
sudo gpasswd -a <username> sudo
If you want to remove the user from sudo group then follow this command:-
sudo gpasswd -d <username> sudo
Conclusion
Congratulations, you have successfully created a new user and added to sudo group to your Ubuntu Linux Server 20.04 LTS system!. You can now log in to your Ubuntu server with this user account and use sudo to run administrative commands. sudo command is the safest way of running commands that require root privileges. That’s all! Feel free to leave a comment if you have any questions.
Hi All, My name is Vikash Ekka from India. I’m the founder and tech editor of https://www.vetechno.in. I have completed my Graduation in BCA. I love to write technical articles like Windows, Linux & MAC Tutorials, Tips, Tricks, How To fix, Tutorials About Ethical Hacking & Cyber Security Guide, and Software Review.
Currently, I have been working as an IT professional since 2018.