I want to run an executable file as root by clicking an icon. I have the following desktop file (test.desktop
) in place:
[Desktop Entry]
Version=1.0
Name=Test Program
Comment=Open test program
Exec=sudo taskset -c 7 /home/username/Desktop/folder1/test_program %f
Icon=/home/username/Desktop/folder1/image.png
Terminal=true
Type=Application
Categories=Utility;Application;
This works, but each time I click the icon it requires me to enter my password, which is growing tiresome. I want this one icon to execute this one program program as root without a password prompt. I do not want to disable the password prompt for all sudo
commands.
test_program
above is an executable which requires root status to run correctly.
Further, if I change the Exec=
line above to
Exec=gksudo -k -u root taskset -c 7 /home/username/Desktop/folder1/test_program %f
the program doesn't actually run, but rather opens terminal then closes terminal immediately.
How can I make this run as root without putting my password in each time?
Requested Edit #1: My edited sudoers file is given below.
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# 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
ALL ALL=NOPASSWD: /home/username/Desktop/folder1/test_program
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
sudo
? That would be a different question (likely duplicate of existing questions on this topic). – Andrea Lazzarotto Aug 16 '16 at 19:51sudo
across the board. @bodhi.zazen, thanks for the feedback. I will look for a tutorial on expect. It is definitely foreign to me. – BFranks Aug 17 '16 at 14:23sudoers
file. – Andrea Lazzarotto Aug 17 '16 at 15:16