My difficulties in finding a prefect ways to share a folder between computers, finally ended. I found a simple and secure way to transfer files or folders between 2 computers. The real reason is I don’t want to use samba or nfs service and I just want to transfer files or folders when I needed, that’s all. I’m lazy to use flash drive too only for move some files or folders from one computer to another.
I found a tool, SSHFS, which capable to achieve my purpose and use it when I needed. For me, it is the solution regarding with moving files or folders.
What is SSHFS?
SSHFS stands for Secure SHell FileSystem. It is a client that enable us to mount and interact with remote files and directories through a secure shell file transfer protocol on local machine. By using SSH, we have a secure line while manage our files or directories remotely using SFTP. SSHFS comes with built-in FUSE (Filesystem in Userspace) kernel module that allows any non-privileged users to create their file system without modifying kernel code.
Step 1. Install SSHFS
The first step to use SSHFS is by installing the SSHFS applications. I’m using Fedora 22, so this article will be done in Fedora distributions. By default, SSHFS is not installed in Fedora 22 and to make it available, do this command in the terminal.
$ sudo dnf install fuse-sshfs
Step 2. Create mount directory
Once the fuse-sshfs application is installed, the next step is create a mount directory in the local machine. This step provide a mount point for remote filesystem. I will make the directory name same with the remote computer name.
I also do this step in the other machine including put some files for verifying purpose.
$ mkdir ijen
Step 3. Mount the remote filesystem
Use the following command to mount the remote file system. The most important is you don’t have to become root user to do this. I will log in as user ‘kris’
to my remote machine (192.168.2.10) and then mount the “merapi” directory into “ijen” directory in my local machine. Don’t forget to type the remote user password when its asked.
$ sshfs firstname.lastname@example.org:/home/kris/merapi ~/ijen/
Step 4. Verify the mounted remote filesystem
If the command above is run successfully without any error, do the following command and you will see some files from the remote computer that now is in your local machine.
$ cd ijen
here is the screen capture of my terminal after the sshfs command successful.
Until this step, you can do what ever you like with the mounted remote filesystem like copy, delete, or move files or directory.
Step 5. Unmount the mounted remote file system
After finish with what you need, to unmount the mounted remote filesystem we can use the following command.
$ fusermount -u ijen/
Done! My mission to manage files or directories between two computers is accomplish.
If you want the remote file system mounted permanent, you can modify your fstab file configuration and put this line in the bottom of that file.
email@example.com:/home/kris/merapi /home/kris/ijen fuse defaults 0 0