SSHFS: Mount Remote File Systems on Linux & Windows (2024)

Introduction

SSHFS (SSH File System) is a command-line tool that uses an SSH connection to mount remote file systems onto a local machine. The SSHFS client uses SFTP to set up local access to remote physical or virtual disks, simplifying remote file management.

This article shows how to use SSHFS to mount remote file systems on Linux and Windows.

SSHFS: Mount Remote File Systems on Linux & Windows (1)

Prerequisites

  • Command-line access.
  • Administrative privileges on the local system.
  • Remote file system credentials.

Note: The recommended way to connect via SSH is to utilize SSH key pairs. Follow our tutorials on how to generate SSH key pairs on different operating systems:

  • How to Generate SSH Keys on Ubuntu
  • How to Generate SSH Key in Windows 10

Installing SSHFS

SSHFS does not come preinstalled on Windows and major Linux distributions. Refer to the sections below for instructions on installing SSHFS.

Install SSHFS on Linux

The command to install SHHFS depends on the Linux distribution and the package manager running on the system. Below are the commands for the two most popular scenarios:

  • Install SSHFS on an Ubuntu/Debian system using the apt package manager:
sudo apt install sshfs
  • Install SSHFS on a RHEL-based system using the yum package manager:
sudo yum install fuse-sshfs

Install SSHFS on Windows

Setting up SSHFS on Windows requires downloading and installing the following programs:

  • The latest stable version of WinFS.
  • The latest stable version of SSHFS-Win.
  • The SSHFS-Win Manager frontend GUI interface (optional). Download the GUI manager on the SSHFS-Win GitHub page.
SSHFS: Mount Remote File Systems on Linux & Windows (2)

Mount Remote File System on Linux

The terminal is the simplest way to mount a remote directory in Linux. The steps below provide a detailed explanation of the mounting procedure.

Step 1: Create Mount Point

To create a mount point directory in /mnt, type the command below:

sudo mkdir /mnt/[mount-point-directory]

Replace [mount-point-directory] with a new directory name.

Step 2: Mount Remote File System Using SSHFS

Mount the remote file system to the mount point created in the previous step. Use the following SSHFS syntax:

sudo sshfs -o [options] [remote-user]@[remote-host]:/[path to remote directory] /mnt/[mount-point-directory]/

If the remote server uses password authentication, enter the password when requested. If it uses SSH key authorization, provide the path to the private key using the IdentityFile option. For example:

sudo sshfs -o allow_other,default_permissions,IdentityFile=/home/kb/.ssh/id_rsa [email protected]:/home/ubuntu/ /mnt/test/
SSHFS: Mount Remote File Systems on Linux & Windows (3)

The above command mounts a remote directory at 131.153.142.254 under the name ubuntu to the /mnt/test/ mount point.

The -o flag introduces the following options:

  • allow_other. Allows access to users other than root.
  • default_permissions. Enables permission checking by the kernel.
  • IdentityFile. Allows the user to provide a path to a private key for SSH key authentication.

For a comprehensive list of available options, enter:

sshfs -h

Note: Getting a connection error? Try troubleshooting with one of our guides:

  • How to Fix the SSH "Connection Refused" Error
  • How to Fix SSH Failed Permission Denied (publickey,gssapi-keyex,gssapi-with-mic)

Step 3: Check Mounted File System

Check if the file system is mapped correctly by navigating to the mount point directory with the cd command:

cd /mnt/[mount-point-directory]
SSHFS: Mount Remote File Systems on Linux & Windows (4)

Alternatively, navigate to the folder in a GUI file browser.

SSHFS: Mount Remote File Systems on Linux & Windows (5)

Step 4: Unmount Remote File System on Linux

To stop using the mount point and interrupt the connection with the remote file system, unmount the remote directory with the umount command:

sudo umount /mnt/[mount-point-directory]

If successful, the command provides no output.

Note: Double-check if you typed the umount command correctly. There is no letter N.

Mount Remote File System on Windows

Windows offers several solutions for mounting remote file systems, including the command line, Windows Explorer, and GUI. The following sections provide steps for each solution.

Via Windows Explorer

Follow the steps below to mount a remote file system using SSHFS and Windows Explorer.

Step 1: Find Map Network Drive Option

Open Windows Explorer. Right-click This PC from the menu in the left pane and select Map network drive.

SSHFS: Mount Remote File Systems on Linux & Windows (6)

Step 2: Mount Remote File System Using SSHFS

Select the drive letter for the remote folder in the Map network drive dialog. Type the following sshfs command in the Folder field:

\\sshfs[.option]\[remote user]@[remote host][!port][\path]

Note: The default port for SSH connections is 22. Malicious actors are aware of this, too. Change the default port if you deal with sensitive information.

Depending on your use case, the sshfs command offers the following options:

  • sshfs maps the remote user's home directory.
  • sshfs.r connects to the remote user's root directory.
  • sshfs.k maps the remote user's home directory and uses the SSH key stored in [local-user]/.ssh/id_rsa.
  • sshfs.kr adds the remote user's root directory and uses the locally stored SSH key.

For example:

\\sshfs.k\[email protected]
SSHFS: Mount Remote File Systems on Linux & Windows (7)

Click Finish to map the remote file system. Upon successfully connecting, the remote file system opens in the File Explorer.

Step 3: Check Mounted File System

The newly mounted file system is visible in the Network locations section of the This PC view:

SSHFS: Mount Remote File Systems on Linux & Windows (8)

Step 4: Unmount Remote File System on Windows via Explorer

To unmount the disk, right-click the mounted device and select Disconnect:

SSHFS: Mount Remote File Systems on Linux & Windows (9)

Via Command Prompt

Mounting a remote file system in Windows via the command line is a one-command operation. Read the steps below to learn how to mount directories using SSHFS.

Step 1: Mount Remote File System With net use

Use the net use command to mount the remote file system:

net use [drive letter]: \\sshfs[.option]\[remote user]@[remote host][!port][\path]

For example:

net use X: \\sshfs.k\[email protected]

The command does the following:

  • X: assigns the drive letter to the remote folder.
  • sshfs.k allows you to submit an SSH key stored in [local-user]/.ssh/id_rsa.
  • [email protected] is the remote user and host.
SSHFS: Mount Remote File Systems on Linux & Windows (10)

The output of the command informs of a successful connection.

Step 2: View Mounted Device(s)

To view the currently mounted disks through SSHFS, run:

net use
SSHFS: Mount Remote File Systems on Linux & Windows (11)

The command outputs the local mount point name and the remote connection point.

Step 3: Unmount Remote File System on Windows via CMD

To remove the mapped device from your system, run the following:

net use [drive-letter]: /delete

For example, if the remote file system is on the drive X, use:

net use X: /delete
SSHFS: Mount Remote File Systems on Linux & Windows (12)

Via SSHFS-Win Manager

The SSHFS-Win Manager offers a convenient and easy-to-use GUI for establishing and managing remote server connections. Follow the steps below to use SSHFS-Win to map a new remote directory.

Step 1: Run SSHFS-Win Manager

Search for SSHFS-Win Manager in the Start menu and run the program. Click the Add Connection button in the menu on the right side to add a new connection.

SSHFS: Mount Remote File Systems on Linux & Windows (13)

Step 2: Configure Connection

Fill out the necessary fields and select the options for your scenario:

SSHFS: Mount Remote File Systems on Linux & Windows (14)
  • Name is a custom name for your connection.
  • IP/Host is the host address.
  • Port is 22 by default for SSH connections. Leave it as is if you did not change the port.
  • User is the username of the remote system.
  • The Authentication method is either through a private key file or a password. If using the secret key file, provide the path. Alternatively, the password option allows providing a password immediately or when establishing a connection.
  • The Remote path is the path to the remote file system.
  • Local drive letter lists locally available drive letters for a mount point.

Click Save when you are done filling out the fields. The newly created server connection shows up in the main menu.

SSHFS: Mount Remote File Systems on Linux & Windows (15)

Step 3: Mount Remote File System and View Contents

Click the socket icon next to your connection name to establish a connection. If the connection succeeds, the socket icon changes to a green connected socket, and a folder icon appears:

SSHFS: Mount Remote File Systems on Linux & Windows (16)

Click the folder icon to view the contents of the remote file system.

Step 4: Unmount Remote File System on Windows via SSHFS Win-Manager

To unmount the server connection, click the socket icon in the SSHFS Win-Manager menu. If the connection is no longer needed, delete the information using the Delete mode button.

Note: For SSHFS on macOS, read our guide How to Mount Remote File Systems via SSHFS on macOS.

Conclusion

SSHFS provides a secure way to mount a remote directory to a local machine. The connection uses the SSH file transfer protocol for each transferred file, ensuring secure communication between two points.

An alternative way to transfer files via SSH is through remote sync. Check out our guide, How to Transfer Files with Rsync, and see which method suits you best.

SSHFS: Mount Remote File Systems on Linux & Windows (2024)
Top Articles
5 Safety Tips When Connecting to Wi-Fi Overseas | Latitude 28° Global
Help And Training Community
Plaza Nails Clifton
What's Wrong with the Chevrolet Tahoe?
Chase Claypool Pfr
Gina's Pizza Port Charlotte Fl
Edible Arrangements Keller
Brutál jó vegán torta! – Kókusz-málna-csoki trió
2024 U-Haul ® Truck Rental Review
978-0137606801
Powerball winning numbers for Saturday, Sept. 14. Check tickets for $152 million drawing
Kp Nurse Scholars
The Menu Showtimes Near Regal Edwards Ontario Mountain Village
Robin D Bullock Family Photos
A Biomass Pyramid Of An Ecosystem Is Shown.Tertiary ConsumersSecondary ConsumersPrimary ConsumersProducersWhich
1973 Coupe Comparo: HQ GTS 350 + XA Falcon GT + VH Charger E55 + Leyland Force 7V
Purdue 247 Football
Crossword Help - Find Missing Letters & Solve Clues
2000 Ford F-150 for sale - Scottsdale, AZ - craigslist
Urbfsdreamgirl
Margaret Shelton Jeopardy Age
Table To Formula Calculator
Horses For Sale In Tn Craigslist
Jailfunds Send Message
Warren County Skyward
Gabrielle Enright Weight Loss
#scandalous stars | astrognossienne
Gas Prices In Henderson Kentucky
The Best Carry-On Suitcases 2024, Tested and Reviewed by Travel Editors | SmarterTravel
Today's Gas Price At Buc-Ee's
How to Draw a Sailboat: 7 Steps (with Pictures) - wikiHow
Jail View Sumter
Frommer's Philadelphia & the Amish Country (2007) (Frommer's Complete) - PDF Free Download
Danielle Ranslow Obituary
The Angel Next Door Spoils Me Rotten Gogoanime
Luvsquad-Links
Free Crossword Puzzles | BestCrosswords.com
Academic Notice and Subject to Dismissal
2013 Honda Odyssey Serpentine Belt Diagram
Thothd Download
Cleveland Save 25% - Lighthouse Immersive Studios | Buy Tickets
Zipformsonline Plus Login
Cult Collectibles - True Crime, Cults, and Murderabilia
Lesson 5 Homework 4.5 Answer Key
Sleep Outfitters Springhurst
Image Mate Orange County
Publix Store 840
Factorio Green Circuit Setup
Intuitive Astrology with Molly McCord
Latest Posts
Article information

Author: Fr. Dewey Fisher

Last Updated:

Views: 5691

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.