Maybe you need to work on remote projects, maybe you have multiple computers running different OS’ and you find yourself always going back and forth between them or maybe you just need to access a server. So how would you go about it?
You could use a cloud file hosting servive and sync everything across your computers, but depending on your needs that can get expensive. You could use an USB stick or external HDD/SSD, but if you run different OS’ with different filesystems that can quickly become an unnecessary headache. You can also use a FPT client like Filezilla but you can’t work on the remote filesystem unless you copy the file(s) on your local machine first.
If you don’t already have a system in place that works for you, you should take a look at SSHFS – a file system in user space that uses the SSH File Transfer Protocol (SFTP) to mount a remote file system.
ALSO READ HOW TO: Mount any Torrent File as a Read-Only Directory on Linux and macOS
sshfs command is a client tool for using SSHFS to mount a remote file system from another server locally on your machine.
NOTE: first thing make sure that OpenSSH (client and server – on the remote machine you’ll need the OpenSSH server running ) is installed on both your local machine and remote machine. Also if you’re using a firewall you’ll need to allow the connection or create rules for the connection.
NOTE: this will work in any configuration ( i.e Linux-Linux, Linux-macOS, Linux-Windows and vice-versa )
Mounting a remote filesystem on Linux
1. I assume you know how to check if OpenSSH is installed, if not install it, and make sure it’s running. But just as a quick guide:
- Arch-based distro
sudo pacman -S openssh( this package contains both the client and the server )
- Debian/Ubuntu-based distro
sudo apt-get install openssh-client openssh-server
2. To make sure that the SSH server is running on your remote machine, assuming you’re running systemd, you need to run
sudo systemctl start sshd . If you want to enable the service so it’s always running you can do that with
sudo systemctl enable sshd.
2.1 In my case I’m trying to mount a macOS filesystem. To start SSH on macOS go to
System Preferences > Sharing > Remote Login. You can also do it from the command line with
sudo systemsetup -setremotelogin on. To turn it off from the command line use
sudo systemsetup -setremotelogin off. To check if remote login is enabled/disabled use
sudo systemsetup -getremotelogin
3. Now you’ll need the IP address of the remote machine. You can get that with
ip addr. If you want to do a quick check to see if you can access the remote machine you can
4. Now install
SSHFS. This is straightforward as it’s shipped by all major linux distros. For example:
- Arch-based distros
sudo pacman -S sshfs
- Debian/Ubuntu-based distros
sudo apt-get install sshfs
dnf install fuse-sshfs
yum install fuse-sshfs
5. Where do you want to mount the remote filesystem? Typically you’ll want to mount it in
/mnt. Create a mount point folder in
sudo mkdir folder-name. ( since I’m mounting my macOS filesystem on my Linux machine, I (creatively) named the folder “mac” )
5.1 The folder you’ve just created will be owned by
root. Since it is recommended to not be root, change the ownership to your user with
sudo chwon user:user folder-name
6. Now you can mount the remote machine with
sshfs [user@]hostname:[directory] mountpoint. ( i.e username-of-remote-mac[email protected]:/folder mount-point-of-local-machine )
7. Now when you
cd in the mount point ( or use a GUI file manager ) you’ll see the mounted filesystem.
8. To unmount the remote machine run
fusermount -u /mnt/folder-name/. NOTE: Make sure you’re not using the directory, otherwise it won’t unmount.
NOTE: To keep your desired directory mounted on your system through reboots, you can create a persistent mount by updating your
/etc/fstab file and creating a pair of SSH keys.
NOTE: if you don’t want a persisten mount, you can speed up the process using an alias
Mounting remote a filesystem on macOS
1. Install Homebrew.
2. Once Homebrew is installed, install SSHFS and OSXFUSE with
brew install sshfs && brew cask install osxfuse.
UPDATE 2022: if the above won’t work, download macFUSE and SSHFS and install them manually. Reboot after installation.
3. Now it’s just a matter of following the tutorial for Linux. Turn on SSH ( see above at 2.1 ). Create a folder with any name, anywhere you want to ( I created one called Arch on my desktop ) and once you know the IP of the remote machine and the SSH server runs on it you can mount it with
sshfs [user@]hostname:[directory] mountpoint
4. Once mounted, you’ll notice the folder’s icon changing. And you can access it.
5. To unmount the drive however you will need to do it with
Mounting remote filesystem on Windows
1. Make sure OpenSSH is installed.
2. Install WinFsp and SSHFS-Win.
3. Open Windows Explorer, right click on
This PC and select
Map Network Drive
4. Now specify the drive letter for the connection and mount the drive with
5. Enter the password for the remote machine
6. The remote drive is now mounted.
Learn more about SSHFS and SSHFS-Win. Also don’t forget to
man sshfs and/or