04-27-2016, 06:33 PM
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.
As soon as you type this command, Ubuntu will automatically start the process:
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:
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
Now Press Esc and then write :
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:
Finish up by the deleting the user’s home directory:
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
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: (Select All)
sudo adduser username
- 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
Code: (Select All)
exit
How To Grant The New User with Root Privileges :
You can create the sudo user by opening the sudoers file with this command:
Code: (Select All)
sudo /usr/sbin/visudo
Code: (Select All)
# User privilege specification
root ALL=(ALL:ALL) ALL
username ALL=(ALL:ALL) ALL
Code: (Select All)
:wq
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: (Select All)
sudo userdel username
Code: (Select All)
sudo rm -rf /home/newuser