How to mount remote File System using SSHFS?

How to mount remote File System using SSHFS?
How to mount remote File System using SSHFS?

If you are running a website or working in a development project where you repeatedly need to upload files to your remote VPS or dedicated server file systems, you may like to mount the remote file systems on your local machine. With SSHFS it can be done very easily over SSH. Once you mount the remote file system on your local computer, you can access the remote file system as if you are accessing a folder on your local system.
Not only that using this SSHFS you can mount a remote file system on many computers and thus that remote file system can be used as your personal cloud storage and you can easily share files between different systems using that common mount point. Follow the steps below to mount remote file systems on your Linux and Mac OS X system using SSHFS.

1. Install SSHFS

Install SSHFS on Debian/Ubuntu system

using apt-get you can install SSHFS on Ubuntu and Debian based systems. Open Terminal and run below command:
sudo apt-get install sshfs

Install SSHFS on Mac OS X

A. First of all Install Xcode and Homebrew / Homebrew Cask

B. Now run below command to install SSHFS.

Debaleenas-MacBook-Pro:~ TechEntice$ brew cask install sshfs
==> We need to make Caskroom for the first time at /opt/homebrew-cask/Caskroom
==> We'll set permissions properly so we won't need sudo in the future
Password:
==> Satisfying dependencies
==> Installing Cask dependencies: osxfuse
osxfuse ...
==> Downloading http://downloads.sourceforge.net/project/osxfuse/osxfuse-2.7.5/osxfuse-2.7.5.dmg
######################################################################## 100.0%
==> Running installer for osxfuse; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
==> installer: Package name is FUSE for OS X (OSXFUSE)
==> installer: Installing at base path /
==> installer: The install was successful.
🍺 osxfuse staged at '/opt/homebrew-cask/Caskroom/osxfuse/2.7.5' (6 files, 8.5M)
done
complete
==> Downloading https://github.com/osxfuse/sshfs/releases/download/osxfuse-sshfs-2.5.0/sshfs-2.5.0.pkg
######################################################################## 100.0%
==> Running installer for sshfs; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
==> installer: Package name is SSHFS 2.5.0
==> installer: Upgrading at base path /
==> installer: The upgrade was successful.
🍺 sshfs staged at '/opt/homebrew-cask/Caskroom/sshfs/2.5.0' (3.5M)

2. Mount remote file system on local system

A. First of all create a folder on you local machine. Here I have created imageten folder on Desktop.

B. Run below command to mount the remote file system on your local machine:
sshfs -p 22 my***@********.org:/home/mywind/public_html/img/imageten /Users/TechEntice/Desktop/imageten -o auto_cache,reconnect,defer_permissions,noappledouble,negative_vncache,volname=imageten

use noappledouble to disable creation of .AppleDouble files on Mac OS X.

C. Now, you can see the remote file system has been mounted and the file system can be accessed as imageten folder. Use this file system as regular folder and copy, paste files to upload or download.

This will temporary mount the remote file file system. So if you restart your system, this mount point will not be available anymore, you have perform step 2.B to mount the file system again.

To unmount the file system you can also run below:
sudo umount /Users/TechEntice/Desktop/imageten

Permanently Mount Remote File System

It’s not recommended to mount a remote file system permanently unless you really require it. Because if someone gets access to your local system, he can also access the remote file system.

To mount remote file system permanently you have to edit /etc/fstab:

sudo vi /etc/fstab
Now, add below entry in fstab.
sshfs#root@********.org:/home/mywind/public_html/img/imageten /Users/TechEntice/Desktop/imageten

On Mac OS X you may use Macfusion to mount any remote file system on you local machine. To use it you need to have MacFUSE installed on your system. It has easy GUI control to mount and dismount remote file systems.

A blogger with a zeal for learning technology. Enchanted to connect with wonderful people like you.
Exit mobile version