You are not logged in.

#1 2011-09-21 18:18:18

sweetthdevil
Member
Registered: 2009-10-20
Posts: 417

zenity --passowrd ?

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

#2 2011-09-21 18:29:32

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: zenity --passowrd ?

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

#3 2011-09-21 18:34:58

sweetthdevil
Member
Registered: 2009-10-20
Posts: 417

Re: zenity --passowrd ?

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

#4 2011-09-21 18:57:22

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: zenity --passowrd ?

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

#5 2011-09-21 19:03:53

sweetthdevil
Member
Registered: 2009-10-20
Posts: 417

Re: zenity --passowrd ?

Excellent!!

Many many thanks, work like a charm!

Offline

#6 2011-09-22 09:59:07

sweetthdevil
Member
Registered: 2009-10-20
Posts: 417

Re: zenity --passowrd ?

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

#7 2011-09-22 10:08:29

sweetthdevil
Member
Registered: 2009-10-20
Posts: 417

Re: zenity --passowrd ?

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

Board footer

Powered by FluxBB