View Full Version : [SOLVED] ask password bash

May 9th, 2011, 09:32 AM
In your opinion is it safe to ask password in this way:

zenity --entry --title="Password root" --text="Scrivi la password:" --entry-text "" --hide-text

or if it isn't safe what is the best way?

May 9th, 2011, 10:05 AM
you could just call gksu from your script

May 9th, 2011, 03:32 PM
gksudo --message "Hello" program_name

May 10th, 2011, 08:51 AM
thanks a lot :)

and...if i want to do only from terminal?
For example if i want to crypt a lot of files i'll do a for cycle and if i don't want to write every time the pwd i'll have to set the pwd in this way:

echo -n "Insert pwd: "
read p
list=`zenity --file-selection --multiple --title="Choose files"`
for file in $elenco; do echo $p | gpg --encrypt --passphrase-fd 0 $file

but it doesn't work...

May 10th, 2011, 12:45 PM
so it is not actually the root/admin password that you want?

May 10th, 2011, 01:44 PM
Yes, the first question i wanted to know that!
However i have solved, the code i've pasted before is wrong xD
The correct code is:

stty -echo
echo -n "Insert pwd: "
read p
stty echo
list=`zenity --file-selection --multiple --title="Choose files"`
for f in $list; do echo $p | gpg -c --passphrase-fd 0 $f