You are not logged in.
Pages: 1
Hello all,
I would like to use "zenity --password" option to execute a script using a sudo command.
But after searching the web and the forum, it seems this is a new option of zenity to handle password.
The issue is I do not know how to use it in the script?
So the idea is to execute 3/4 commands needed to sudo user password.
Any idea?
Many thanks for your time,
Regards.
Offline
I doubt what you want possible. zenity --password is, from what I can see, simply a better looking zenity --entry --hide-text.
I'd recommend ktsuss. It's in AUR.
Offline
I am not concern about the security reason - and quite frankly I would rather not install another lib just for that reason, so if it need to save the password in clear in the script than I am ok with it.
Many thank for your time
Offline
Wow, that was simple... I only needed to read the sudo manpage.
-S The -S (stdin) option causes sudo to read the password from the standard input
instead of the terminal device. The password must be followed by a newline
character.
So...
zenity --password | sudo -S some_app_here
Offline
Excellent!!
Many many thanks, work like a charm!
Offline
The only issue with that is the first sudo command is executed properly because the sudo as the password, but the rest of the sudo command of the script failed due to permission.
Any idea?
Offline
Found out,
Just in the interest of sharing info
#!/bin/bash
PASSWORD=$(zenity --password)
echo $PASSWORD | sudo -S "command"
echo $PASSWORD | sudo -S "command"
exit
Offline
Pages: 1