Post4VPS Forum | Free VPS Provider
How to make new user and Delete a user and grant the user with sudo priviliges - Printable Version

+- Post4VPS Forum | Free VPS Provider (https://post4vps.com)
+-- Forum: VPS Discussion (https://post4vps.com/Forum-VPS-Discussion)
+--- Forum: Tutorials (https://post4vps.com/Forum-Tutorials)
+--- Thread: How to make new user and Delete a user and grant the user with sudo priviliges (/Thread-How-to-make-new-user-and-Delete-a-user-and-grant-the-user-with-sudo-priviliges)



How to make new user and Delete a user and grant the user with sudo priviliges - Honey - 04-27-2016

Hello guys,
Today I'll show you how to create a new user.The reason for creating a new user rather than using root is that using root as the main user can cause security risks secondly if several people are using your VPS you will have to make other users too.
When you perform any root tasks with the new user, you will need to use the word “sudo” before the command. This is a helpful command for 2 reasons:
1) it prevents the user making any system-destroying mistakes
2) it stores all the commands run with sudo to a file where can be reviewed later if needed.
Remember : that sudo is as powerful as the root user. If you only need a user for a limited number of tasks on the VPS, you do not need to give them root privileges.
Requirements :
This tutorial requires access to the root user or a user with sudo privileges.
Secondly This TUT works for Ubuntu, It may work on other too.
TUT :
To add a new user in Ubuntu, use the adduser command, replacing the “username” with your preferred username.
Code:
sudo adduser username
As soon as you type this command, Ubuntu will automatically start the process:
  • Type in and confirm your password
  • Enter in the user’s information. This is not required, pressing enter will automatically fill in the field with the default information
  • Press Y (or enter) when Ubuntu asks you if the information is correct
Congratulations—you have just added a new user. You can log out of the root user by typing
Code:
exit
and then logging back in with the new username and password.
How To Grant The New User with Root Privileges :
You can create the sudo user by opening the sudoers file with this command:
Code:
sudo /usr/sbin/visudo
Adding the user’s name and the same permissions as root under the the user privilege specification will grant them the sudo privileges.You must replace "username" with the name of your new user user created
Code:
# User privilege specification
root ALL=(ALL:ALL) ALL
username ALL=(ALL:ALL) ALL
Now Press Esc and then write :
Code:
:wq
After writing that press Enter and you'll pop back to your console.Now your new username has been granted with root privileges.
How To Delete the new user afterwards :
]If you think that you no longer want to have a specific user on the vps then you can delete them with a single command:
Code:
sudo userdel username
Finish up by the deleting the user’s home directory:
Code:
sudo rm -rf /home/newuser
And That's It! If you need any help then contact me.If you got some new information from my tutorial then please give me a +1 Smile