How to use sudo in a bash script?
Chris Dunn
chris at tropictc.com
Thu Oct 6 17:27:15 UTC 2005
>>>> For instance I want to include :
>>>>
>>>> sudo synaptic
>>>>
>>>> in a script to put on a button in the task bar.
>>> If you want it to run graphically, you need gksudo instead of sudo.
>> Thanks for the two responses suggesting gksudo. This takes me a stage
>> further. I now have :
>> gksudo usr/sbin/synaptic
>> in the script.
>> Sure enough this opens a window to enter a password, but then synaptic
>> does not run after the correct password is entered.
>> gksudo -u <username> usr/sbin/synaptic gives the same result.
>> More enlightenment please.
> Are you trying to run this in an account with sudo privileges? By
> default, that's the account you created during installation. If not,
> you'll have to add that account in sudoers. Check the man pages (I'm
> not in front of Ubuntu right now).
Yes I am. Under the same session I can open a term window, run synaptic,
enter the password in the pop-up window, and synaptic runs happily.
All I'm trying to do is shortcut this by putting a button launcher in
the taskbar to achieve the same results.
Chris Dunn
More information about the ubuntu-users
mailing list