You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

SSHFS is a filesystem client to mount and interact with directories and files located on a remote server or workstation over a normal ssh connection.

Install SSHFS


To mount directory in remote server, you will need to install SSHFS

sudo yum -y install sshfs


Once installed, you can simply try to mount your remote server. Note that the remote server must support SSH.

sshfs ck@192.168.10.7:/data/disk1 /mnt/disk1


Auto-mount remote directory while server boot

If you want to setup auto-mounting remote directory, you need to create your own signature like below

ssh-keygen -t rsa -b 4096 -C "ck@ckii.com"

While you create your own key, you will need to put your location where to save your key. By default, it will be saved to /YOUR_HOME_DIR/.ssh/id_rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/ck/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ck/.ssh/id_rsa.
Your public key has been saved in /home/ck/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:EociK2DFhCX85+RuLAoj2pGdr/QXqbNzSiAzUwxOdV4 ck@ckii.com
The key's randomart image is:
+---[RSA 4096]----+
| .+*= o E        |
| oo=.o + .       |
|  +.o + . .      |
| . o. o+ .       |
|  = o=. S.       |
|   B +o o        |
|  o +..o .       |
|...o +B +        |
|o.ooo+=O         |
+----[SHA256]-----+

Follow-up action you need to do is copying ID by ssh-copy-id <id@remote_server>

ssh-copy-id ck@192.168.10.7

If everything went well, you will be able to connect to your server without typing pass-phrase like before.


In order to auto-mount remote directory, you will need to add following lines at /etc/fstab

user_id@server_address:<where_to_mount> <target_directory> fuse.sshfs defaults,idmap=user,allow_other,reconnect,_netdev,users,IdentityFile=<your_key_location> 0 0

Below is an working example

kurapa@192.168.10.7:/data/disk1 /mnt/disk1 fuse.sshfs defaults,idmap=user,allow_other,reconnect,_netdev,users,IdentityFile=/home/ck/.ssh/id_rsa 0 0
  • No labels