hans

hans

Create user and give sudo permissions in CentOS 7

Run the following commands under the sudo su user:

  1. Create a user:
adduser username
  1. Set a password:
passwd username
  1. Change the file permissions to allow editing:
chmod -v u+w /etc/sudoers
  1. Enter the file editor:
vim /etc/sudoers
  1. The file content should be changed as follows:
root ALL=(ALL) ALL Existing line
username ALL=(ALL) ALL New line
  1. Change the file permissions to read-only:
chmod -v u-w /etc/sudoers
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.