LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Passing password to encfs (https://www.linuxquestions.org/questions/linux-newbie-8/passing-password-to-encfs-4175536732/)

mackowiakp 03-14-2015 12:40 PM

Passing password to encfs
 
There is an option in encfs:

--extpass=program Use external program for password prompt

I want to use such program for this:

#!/bin/bash
zenity --entry --title="password dialog" --text="Enter your _password:" --hide-text

But how can I pass such obtained password to entfs call?

Any idea?

unSpawn 03-15-2015 06:01 AM

Couple of things, really. First of all you know about "--extpass=" because you read about it somewhere. If you don't know what or how then the first thing would be to 'man encfs' to learn about using it. The manual page should show an example so you could test that. If you're satisfied it works as advertised you could leave it at that. If not, then the manual tells you the only requirement is the application printing the pass phrase on stdout. That's something you can test with the command you suggested and then just pass --extpass='/apth/to/yourscript.sh' as argument.

mackowiakp 03-15-2015 06:18 AM

I read it, so finally I got it working.

Main script looks like this:

Code:
#!/bin/bash
sudo encfs --extpass=/home/maciek/Pobrane/zen --public /home/maciek/dir/.dir_c /home/maciek/dir_v >/dev/null 2>/dev/null
status=$?
if test $status -eq 0
then
mount /home/maciek/.ssh
zenity --timeout=10 --info --text "Poczono SSH"
exit
else
umount /home/maciek/.ssh 2>/dev/null
sudo fusermount -u ~/dir_v 2>/dev/null
zenity --timeout=10 --error --text "Rozczono SSH lub bdne haso"
fi



Where "zen" script is:

Code:
#!/bin/bash
xhost local:maciek > /dev/null
zenity --entry --title="password dialog" --text="wprowa haso do SSH:" --hide-text



So i placed icon on pulpit, linked to main script. But I must set in "konsole" options "Run in terminal" (KDE environment). In other case, script always fails that is "zen" script does not start.
Is any possibility to hide or turn off terminal window during call such script?

unSpawn 03-15-2015 07:34 AM

Maybe create a .desktop file for it in ~/.local/share/applications/ and set "Terminal=false"?

mackowiakp 06-23-2015 11:21 AM

Commenting the line in /etc/sudoers, containing

#Defaults requiretty

resolved the problem!


All times are GMT -5. The time now is 05:39 PM.