- echo PASSWORD | sudo -S COMMAND
- adding following lineto /etc/sudoers:
username ALL=(ALL) NOPASSWD: COMMANDPlease note that this has to be after all group definitions.
You can check what sudo priviliges you have using
sudo -lFor this case this gives:
(ALL) ALLThis 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) NOPASSWD: COMMANDThis would still require password for all commands.