Thursday, August 14, 2014

Give current user access to run a script as root

In a one liner:
# Append to a file using sudo to keep this a one liner
sudo echo "`logname` ALL=NOPASSWD:/opt/scripts/foo.sh" | sudo tee -a /etc/sudoers >/dev/null

No comments:

Followers