How To Add and Delete Users on a CentOS Server
Adding Users
If you are signed in as the root user, you can create a new user at any time by typing:
adduser username
If you are signed in as a non-root user who has been given sudo privileges, you can add a new user by typing:
sudo adduser username
Next, to set password for your user so that they can log in. To do so, use the passwd command:
passwd username
Note: Remember to add sudo ahead of the command if you are signed in as a non-root user with sudoprivileges.
You will be prompted to type in the password twice to confirm it. Now your new user is set up and ready for use! You can now log in as that user, using the password that you set up.
Granting root/Sudo Privileges to a User
We can do this by adding the user to the wheel group (which gives sudo access to all of its members by default) through the gpasswd command. This is the safest and easiest way to manage sudo user rights.
If you are currently signed in as the root user, type:
gpasswd -ausername wheel
If you are signed in using a non-root user with sudo privileges, type this instead:
sudo gpasswd -ausername wheel
Now you can check all user which have root/sudo privileges
sudo lid -g wheel
It will show you list of all user with group root
Deleting Users
If you have a user account that you no longer need, it’s best to delete the old account.
If you want to delete the user without deleting any of their files, type this command as root:
userdel username
If you want to delete the user’s home directory along with the user account itself, type this command asroot:
userdel -r username
- Jquery webcam plugin - June 19, 2016
- How To Add and Delete Users on a CentOSServer - June 5, 2016
- How To Set Up vsftpd on CentOS 6 - June 5, 2016