Sudoers File To Allow Certain Users Use Command Without Password



Steps To Edit Sudoers File:

  1. Login Linux server as root.
  2. Create new group. Example king .

  3. Create new user and directly add it into just created group. Example kong . Make sure to assign it a password.

  4. Edit sudoers file.

  5. At the end of the line, put the line given below and save it. Example we use here is command to list users. Please note that % put in front of means we make it for group but if there is no %, means we make it for single user. 



  6. Test the sudo command. It will execute without password needed.

  7. To block certain commands, can use !. Example, !cat /etc/passwd.
  8. To make sure user allowed to use certain commands only. farid ALL = NOPASSWD : /bin/passwd mamat .
  9. To make sure group allowed to use certain commands only. %faridah ALL = NOPASSWD : /bin/passwd mamat .

Comments

Archive

Contact Form

Send