You can use
gksu - GTK+ frontend for su and sudo
gksu is a frontend to su and gksudo is a frontend to sudo. Their primary purpose is to run graphical commands
that need root without the need to run an X terminal emulator and using su directly.
- Open Startup Applications (System Settings > Startup Applications or
- Add new Entry with following command (
gksudo myscript or
Click Add and this script will run when you startup/login to desktop.
Note:- Make sure
gksu is installed in order to work with
gksudo. (you can install it by
sudo apt-get install gksu)
Another way is to use Askpass program which works with
Normally, if sudo requires a password, it will read it from the user's terminal. If the -A
(askpass) option is specified, a (possibly graphical) helper program is executed to read the user's
password and output the password to the standard output. If the SUDO_ASKPASS environment variable
is set, it specifies the path to the helper program. Otherwise, if sudo.conf(5) contains a line
specifying the askpass program, that value will be used. For example:
# Path to askpass helper program
Path askpass /usr/X11R6/bin/ssh-askpass
Example I use
zenity as askpass helper.