{"id":24631,"date":"2017-12-26T02:10:26","date_gmt":"2017-12-26T08:10:26","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=24631"},"modified":"2022-06-03T03:35:20","modified_gmt":"2022-06-03T08:35:20","slug":"how-to-create-and-delete-user-on-ubuntu-16-04","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-delete-user-on-ubuntu-16-04\/","title":{"rendered":"How to Create and Delete User on Ubuntu 16.04"},"content":{"rendered":"
<\/p>\n
We will show you how to create and delete a user on Ubuntu 16.04. By default, when your server is created for the first time, only a root user account is created. This root account has access to all the files and commands on the system. But having too many privileges and running as root user is not always recommended and if you are not careful enough can be destructive for your system. That’s why it is recommended to create additional users with limited privileges for your most common tasks. A new user account should also be created for any other user that will be using your server.\u00a0 Additionally, you can also give those users root privileges when necessary through the sudo command.<\/p>\n
<\/p>\n
First, you need to connect to your server<\/a> as user root via SSH.<\/p>\n Once logged, you can create a new user with the adduser<\/strong> command. To add a user called “tom”, you can type the following in your command line:<\/p>\n You will be asked some additional questions. This is the output that you should get, for our new user called tom:<\/p>\n With this, your new user called “tom” has now been successfully created. Its home directory has also been created at the following location on your server: \/home\/tom<\/p>\n Once we no longer need a specific user, we can delete it with the deluser<\/strong> command.<\/p>\n Let’s say we want to delete the user “tom”. You can run the following command to do this:<\/p>\n However, this will not delete the user’s home directory. If you want to delete the user’s home directory as well, you should run the following command:<\/p>\n The user is now completely removed from our system.<\/p>\n This is all you need to know when it comes to creating and deleting a user on Ubuntu 16.04<\/a>.<\/p>\n Of course, you don\u2019t have to create and delete users on Ubuntu 16.04 ,\u00a0 if you use one of our managed\u00a0VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to help you create a new or delete an existing user on Ubuntu 16.04. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n PS<\/strong>.<\/span> If you liked this post on how to create and delete a user on Ubuntu 16.04, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":" We will show you how to create and delete a user on Ubuntu 16.04. By default, when your server is … <\/p>\nadduser tom<\/pre>\n
\nFirst, you will need to enter and confirm a password for this user.
\nThen you will be asked for some additional information about the user, such as full name, room number, work phone, home phone and other. This information is optional and you can just press ENTER on each question to skip it.
\nAt the end, you will be asked for confirmation about all the information you have entered so far. If everything is correct just press Y and then Enter.<\/p>\nAdding user `tom' ...\r\nAdding new group `tom' (1000) ...\r\nAdding new user `tom' (1000) with group `tom' ...\r\nCreating home directory `\/home\/tom' ...\r\nCopying files from `\/etc\/skel' ...\r\nEnter new UNIX password:\r\nRetype new UNIX password:\r\npasswd: password updated successfully\r\nChanging the user information for tom\r\nEnter the new value, or press ENTER for the default\r\nFull Name []:\r\nRoom Number []:\r\nWork Phone []:\r\nHome Phone []:\r\nOther []:\r\nIs the information correct? [Y\/n] Y<\/pre>\n
Delete a User on Ubuntu 16.04<\/h2>\n
deluser tom<\/pre>\n
deluser --remove-home tom<\/pre>\n