sreda, 14. november 2012

Running sudo command without password

What I found out is that running a command using sudo without entering password there are two options:

  • echo PASSWORD | sudo -S COMMAND
  • adding following lineto /etc/sudoers:
username ALL=(ALL) NOPASSWD: COMMAND
Please note that this has to be after all group definitions.
You can check what sudo priviliges you have using
sudo -l
For this case this gives:
(ALL) ALL
(ALL) NOPASSWD: COMMAND 
This means that all command require password except for the COMMAND. If we would put the username definitin before group definitions sudo -l would give:
(ALL) NOPASSWD: COMMAND
(ALL) ALL
This would still require password for all commands.
Objavite komentar