Even though you can skip entering password using below command, you need to enter the word sudo in front of the command you enter.
But this procedure will skip the password entering for the particular command and particular user.
You need to do the following, on the terminal type
sudo visudo
and add a line like this at the end of the file specifying the commands you want to run without typing the sudo password (I suggest you use each command you want to use in the program and not just allow all programs to be executed by this)<yourusername> ALL=NOPASSWD: <command1>, <command2>
Now you can run the specified commands without password as long as you type that command with
sudo
.
ie: lets say you want to run
shutdown -r now
without having to type sudo password every time and your username is 'joedoe'- type
sudo visudo
on a terminal - Add
joedoe ALL=NOPASSWD: /usr/sbin/shutdown -r now
as a new line at the end of the file, use absolute paths to the program you are trying to use. - on your program you can then use
sudo shutdown -r now
without having to type the sudo password.
You can find the absolute path to a program by using
which <program name>
on a terminal.
Its a very dirty trick wish leaves your system open for other dangers but I am guessing you know what you are doing and want this
No comments:
Post a Comment