3

I have a folder which is stored on a remote server and which is mounted locally using sshfs. Obviously, this requires a password to log on to the server. I would like to get a gui to prompt me for this password.

I managed to do this with a script using zenity and expect, but apparently expect is not secure. So how can I do this properly?

Note, I only want this when mounting this folder, not when doing any other ssh-related things. I want to bind it then to the quicklaunch icon of the folder, and so only then I need the GUI.

As a bonus, I would prefer this without the terminal ever showing up. When I used a script with zenity, the terminal seemed to pop up behind the GUI. This is not a real problem, but it would be more aesthetically pleasing if it didn't.

1 Answer 1

2

You can use SSH_ASKPASS environment variable. There is package ssh-askpass which provide GUI application, which can be used to request password from a user, if the script is running under the user X. You can try that in this way:

export SSH_ASKPASS=/usr/lib/ssh/x11-ssh-askpass
sshfs [mount arguments]

In this case, you should see the GUI prompt jumping up and letting you enter the password.

5
  • Ok, that seems to work, thanks. As a follow up, but not really important: I'm not such a fan of the design of this GUI, any ideas how (or of) you can, in an easy way, make it look better?
    – Lu Kas
    Oct 11, 2016 at 11:14
  • 1
    There are different "version" of askpass, as you can search in the package repository, namely lxqt-openssh-askpass, razorqt-openssh-askpass, ssh-askpass-gnome, which might look better.
    – Jakuje
    Oct 11, 2016 at 11:16
  • Hmm, maybe I'm being a bit dumb, but how do I use these then? Are they (or some) already installed? Then where are they located? If I download for example the gnome one and open it with the package installer, it says it will break the existing ssh-askpass ...
    – Lu Kas
    Oct 11, 2016 at 11:36
  • Maybe you would have to remove the previously installed ssh-askpass. If you will list the files from these packages, you will find the binary providing the prompt. Though, these packages should set up the environment in your session on their own, so you should be good with installing them and re-login.
    – Jakuje
    Oct 11, 2016 at 11:38
  • Ok, I used apt instead of downloading the package manually, and that didn't give any problems (or resolved them itself). The gnome one at least looks much better (and is located in lib/openssh). Thanks very much for your help.
    – Lu Kas
    Oct 11, 2016 at 11:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .