For new users and students, learning basic tasks like creating new users, deleting and adjusting group permissions are necessary skill to have when managing Linux servers… Linux servers are managed primarily via the command line terminal… so learning these tasks are crucial in building your skills.
When you’re installing Ubuntu server the first user you create is automatically the administrative account… this account is added to the sudo program to use and execute the sudo command.
To add additional accounts, you’ll have to create them.
This brief tutorial is going to show students and new users how to quickly create new users on Ubuntu servers via the command line terminal. We’ll then show you how to delete user accounts who you don’t want the servers.
When you’re ready to create a new users on Ubuntu servers, follow the steps below:
Step 1: Creating Users on Ubuntu Servers
To create new user accounts on Ubuntu server, your account must be a sudo enabled account… or the root account. Only administrative account can make administrative changes on the server.
To create a new account called richard, you run the commands below
sudo adduser richard
Replace richard with the user account name you wish to add.
When you run the commands above, you will get prompts to enter some more details of the user as well as creating the new user password. When you’re done, type Y for yes to save the information.
Adding user `richard' ... Adding new group `richard' (1001) ... Adding new user `richard' (1001) with group `richard' ... Creating home directory `/home/richard' ... Copying files from `/etc/skel' ... Enter new UNIX password: Create new password for richard Retype new UNIX password: Retype password passwd: password updated successfully Changing the user information for richard Enter the new value, or press ENTER for the default Full Name : Richard Room Number : 101 Work Phone : 7632283373 Home Phone : 2089878233 Other : None Is the information correct? [Y/n] Y
This is how one creates new user accounts on Linux system using the terminal.. Remember, the user account is automatically created as a standard account… this account won’t be allowed to carry out any administrative tasks. To allow the user do administrative tasks, add the user to the sudo program.
Step 2: Deleting User Accounts on Ubuntu Servers
Now that you’ve learned how to create new user accounts on Ubuntu, the steps below show you how to delete an account on Ubuntu… To delete an account named richard, simply run the commands below.
sudo deluser richard
Running the commands above will delete the account but won’t delete the user home directory and all its content.. to delete an account and also delete its home directory, run the commands below.
sudo deluser --remove-home richard
That will completely remove the user home directory as well.
This is how one creates and deletes accounts on Ubuntu servers.
You may also like the post below: