It looks like you're new here. If you want to get involved, click one of these buttons!Sign In Register
It looks like you're new here. If you want to get involved, click one of these buttons!
SSHFS (SSH Filesystem) is a filesystem client to mount and interact with directories and files located on a remote server or workstation over a normal ssh connection. The client interacts with the remote file system via the SSH File Transfer Protocol (SFTP), a network protocol providing file access, file transfer, and file management functionality over any reliable data stream that was designed as an extension of the Secure Shell protocol (SSH) version 2.0. The current implementation of SSHFS using FUSE is a rewrite of an earlier version.
FUSE (Filesystem in Userspace) is an interface for userspace programs to export a filesystem to the Linux kernel. The FUSE project consists of two components: the fuse kernel module (maintained in the regular kernel repositories) and the libfuse userspace library (maintained in this repository). libfuse provides the reference implementation for communicating with the FUSE kernel module.
A FUSE file system is typically implemented as a standalone application that links with libfuse. libfuse provides functions to mount the file system, unmount it, read requests from the kernel, and send responses back.
apt-get install sshfs
To start we will need to create a local directory in which to mount the verser's file system.
sshfs root@ip_of_server:/ /mnt/name_of_directory
Now you can work with files on your remote server (or like in this tutorial's example on local folder) as if it were a physical device attached to your local machine. For instance, if you move to the /mnt/name_of_directory directory on your local machine you can create a file locally and the file will appear on your virtual server. Likewise you can copy files into the /mnt/name_of_directory folder and they will be uploaded to your remote server in the background.
To see all mounted devices you can use command:
Note: This process provides only a temporary mount. If the VPS is restarted, you will need to use the same process to mount it again.
SSHFS also allows for setting up permanent mount points to remote file systems. This would set a mount point that would persist through restarts of both your local machine and servers. In order to set up a permanent mount point, we will need to edit the /etc/fstab file on the local machine to automatically mount the file system each time the system is booted.
First we need to edit the /etc/fstab file with a text editor.
nano /etc/fstabNote: If nano is not installed on your server you can do it with command:
apt-get install nano
Scroll to the bottom of the file and add the following entry
sshfs#root@ip_of_server:/ /mnt/name_of_directorySave the changes to /etc/fstab and reboot if necessary.
Note: Permanently mounting your VPS file system locally is a potential security risk. If your local machine is compromised it allows for a direct route to your server. Therefore it is not recommended to setup permanent mounts on production servers.