1

I create small script to mount encfs filesystem. just like this:

#!/bin/bash
kdialog --password "Wprowadź hasło do SSH lub ENTER żeby rozłączyć:" >  /home/maciek/Pobrane/pass-1
sudo encfs -S --public /home/maciek/dir/.dir_c /home/maciek/dir_v < /home/maciek/Pobrane/pass-1
status=$?
if test $status -eq 0
then
cat /dev/null > /home/maciek/Pobrane/pass-1
<command_A>
kdialog --passivepopup "Zamontowano SSH" 5
exit
else
cat /dev/null > /home/maciek/Pobrane/pass-1
<command_B>
kdialog --passivepopup "Rozłączono SSH lub błędne hasło" 5
fi

It works OK, when running from terminal as ordinary user or as root. Than I create shortcut on my KDE desktop to run that script. And I have to use option "Run in terminal" in shortcut definition because in other case "encfs" does not mount filesys, because of wrong password. But the password was entered correctly. What I im doing wrong so script works properly only started from "konsole" terminal in KDE?

  • Why are you mounting the filesystem as a separate user? encfs is designed to work as your user. – Gilles Mar 22 '15 at 17:13
  • Yes, but basically I use encfs to encrypt content of .ssh directory containing private keys for connecting to servers I manege (about 20). This .ssh dir is located in user home dir but root must use the same .ssh keys too. It is necessary for me because my previous laptop was stolen and I search for solution to keep RSA private keys in more safe way. It was terrible for me to change content of authorized_keys file in 20 servers located country wide. – mackowiakp Mar 23 '15 at 6:26
1

Commenting the line in /etc/sudoers, containing

#Defaults requiretty

resolved the problem!

0

to run commands that prompt for input and refuse to read from STDIN i run the command in screen, wait a second, then feed input to it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.