We were looking for a method which provides us with a secure connection to share files, use a wiki system and establish a bazaar repository on it. We have read on SSH-VPN but it was imposing lots of changes to our systems. We have finally decided to use SSHFS which is simpler and easier to apply in comparison to VPN.
By using SSHFS you can mount a remote folder using a secure SSH connection.
In the following example machine A will mount a folder located in a remote computer, machine B.
- First of all, in machine A you need to create a RSA key pair with the following command as explained here.
ssh-keygen -t rsa
- Send your public key to machine B. Path of the public key you just created is:
- Make sure that machine B has the openssh-server installed. If not, install it with the command:
sudo aptitude install openssh-server
- Start openssh daemon in machine B:
This is for Ubuntu. You have “stop” and “restart” options.
- Create a user in Machine B. In our example, this user has the name of “Lex”. Set appropiate permissions for Lex. Then put the public key file of machine A to the folder:
- Create a folder to mount remote folder in machine A:
- Mount remote folder with the command in machine A:
sshfs Lex@ipaddress:/ ~/bridge
You’ll be asked for your passphrase which you have entered during creation of machine A’s RSA key pair. You have to enter that correctly in order to establish the connection. Otherwise you’ll get the error message: “Connection reset by peer”
If you successfully enter your passphrase you won’t be asked for it again during the same session.
- If you have typed your passphrase correctly, you should have established a SSH connection between machine A and machine B and you should have access to machine B within the scope of user Lex’s permissions.
Now enjoy to share a folder with a remote computer. Contents of this folder will be updated in real time in Nautilus, which we found really cool.
To unmount the folder you can use this command in machine A:
fusermount -u ~/bridge
To stop SSH daemon, use this command in machine B:
This howto is based on the howto here.
- SSH at Ubuntu Community Docs
- Advanced OpenSSH at Ubuntu Community Docs
- Using GPG to signing for SSH Howto at Ubuntu Community Docs
From defending clients to defending code. Developing software professionally in the U.S., offering legal advice on the side, and gaming like it’s still the ’90s. LLM Exeter, PhD(c) in Private Int’l Law. Defender of Kaer Morhen.