How can I execute a sudo command by double clicking an icon ( password should be part of the script). Please help! Excuse if question is a blunder. My gnome-ppp is not detecting my BSNL modem when I run w/o sudo command. I would like to make a executable file for the sudo command sudo gnome-ppp.
Asked
Active
Viewed 631 times
3
1 Answers
5
Instead of hard-coding the password (which is completely insecure, and breaks if you ever change it), you should edit the sudoers file and allow sudo gnome-ppp to be run without a password:
First, check if you're in the adm user group:
groups
This should give you a list of your groups; I chose adm, because that includes users who can administer the system. It may be admin in your case; adjust accordingly.
Now find where gnome-ppp lives:
which gnome-ppp
This will give you the full path; in my case, it's /usr/bin/gnome-ppp
sudo visudo
and add the line at the bottom:
%adm ALL = NOPASSWD: /usr/bin/gnome-ppp
Save the file; now when you call sudo gnome-ppp, you will not be prompted for a password.