How to Create Sudo User on CentOS
Working with root (admin privileged user) in CentOS is not a good idea because you can easily make a costly mistake. Instead, it’s much better to grant the special sudo privileges which allow a regular user to run super user commands by just preceding the commands with sudo in front.
Example of a sudo command:
By default, a fresh CentOS installation does not have a sudo user. To create a new sudo user, you first need a regular user. To create it run the command:
sudo adduser your_user
Next, change the password for your new user with the command:
sudo passwd your_user
Then open the file /etc/sudoers and you have two options. First is to add a user which is asked for a password when running sudo commands:
your_user ALL=(ALL:ALL) ALL
The second, less secure alternative is to allow the user to run sudo commands without being asked for a password:
your_user ALL=(ALL:ALL) NOPASSWD:ALL
That’s how easy it is to have a sudo user in CentOS if you already don’t have one or if you need additional ones.
You can also read the related article about how to create a sudo user on Ubuntu.
CommentsSo empty here ... leave a comment!