When I open a ssh session in the terminal, it asks for my passphrase in a graphical prompt window. That would be ok in theory. But I don’t know my passphrase. So I need to copy it from my password manager. And unfortunately the stupid window doesn’t allow me to access anything else. So, I wanted to disable it.
The usual way is with the environment variable
SSH_ASKPASS. To disable the graphical prompt, just remove the value of this variable:
Unfortunately, in my case this did not work and I needed to remove also another variable:
Install ssh on the server:
apt-get install openssh-server
Generate a key pair (files
id_rsa.pub) with a passphrase:
Edit the ssh configuration file:
In the file, make the following settings:
Add the public key as an authorized key for
root that can be used for login:
cat id_rsa.pub >> /root/.ssh/authorized_keys
That’s all for the server!
Now for the client. Copy the key pair into the folder
~/.ssh. Now you should be able to connect with:
ssh -i ~/.ssh/id_rsa root@server
Mount a file system on a different computer via ssh:
sshfs -o follow_symlinks user@server:/home/user/ /path/to/mount/point
server is the other computer,
user is your username on the other computer and
/home/user/ is the folder you want to include from the other computer.
/path/to/mount/point is the place on your drive where the files will be located. It needs to be a folder that exists and is empty.
To get rid of the mounted folder again use
This is probably a very old hat for Linux-savy people. You can use
ssh to execute commands on a remote server, just pass them on as an additional argument:
ssh firstname.lastname@example.org "cd bla ; ls ; python test.py "
I use double quotes (“) istead of single quotes (‘) to interpret variables. Different commands are separated with semicolon (;). You can use any command you like, but for some reason when I call some GUI I don’t get the output on the command line until the window is closed.
Dolphin allows you to connect to folders on other machines per SSH, but there is no option to specify a key file. But you can add the key to your general SSH configuration (with the added benefit that you also won’t have to specify the keyfile anywhere else, no more
-i on the command line!). This is how it works:
- Locate your private key file, say it’s
- Open or create the file
~/.ssh/config and add the lines
fish://email@example.com/path/to/folder/ into the location bar.
- Now it should ask for the passphrase to your key.