How to mount a remote folder with SSH connection in Ubuntu 8.04

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.

1. 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

2. Send your public key to machine B. Path of the public key you just created is:


3. Make sure that machine B has the openssh-server installed. If not, install it with the command:

sudo aptitude install openssh-server

4. Start openssh daemon in machine B:

/etc/init.d/ssh start

This is for Ubuntu. You have “stop” and “restart” options.

5. 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:


6. Create a folder to mount remote folder in machine A:

mkdir ~/bridge

7. 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.

8. 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:

/etc/init.d/ssh stop

This howto is based on the howto here.


Av. Ertuğrul Harman
2004 yılından beri aktif olarak avukatlık ve danışmanlık yapıyor. Hukuk bürosu İstanbul'da. Yüksek lisansını İngiltere'de tamamladı. İstanbul Ünversitesi'nde hukuk doktorası tezi yazıyor. Çok iyi derecede İngilizce biliyor. Hukukun yanı sıra programlama ve teknoloji ile de ilgileniyor.

Bir Cevap Yazın