Sometimes we don't want normal users to provide sudo rights. but we want to run some scripts which can only run with the sudo.
in that case we can set user rights that will run only specific script with sudo privilleges.
You can perform this by three ways.
Method 1:
Create file (vim /etc/sudoers.d/iosys) and add below lines in created file.
username ALL=NOPASSWD:/command/to/execute
username ALL=NOPASSWD:/command/to/execute
Note: Change username accordingly.
Method 2:
Open below configuration file, and made provided changes into it.
nano /etc/sudoers
Edit it with below lines,
# User privilege specification
root ALL=(ALL:ALL) ALL
ALL ALL =(root) NOPASSWD:/command/to/execute
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
%sudo ALL=NOPASSWD:/command/to/execute
No comments:
Post a Comment