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
Coming to France? Your Covid-19 questions answered
El Salvador became the first country to accept Bitcoin as legal tender. Now it’s offering citizenship for a $1 million ‘investment’
The Tribes and Castes of the Central Provinces of India, Volume 3
Drury Inn & Suites Bowling Green
Angela Babicz Leak
Mate Me If You May Sapir Englard Pdf
Craigslist Free Stuff Appleton Wisconsin
Lowes 385
Wmlink/Sspr
Cape Cod | P Town beach
Best Food Near Detroit Airport
Local Collector Buying Old Motorcycles Z1 KZ900 KZ 900 KZ1000 Kawasaki - wanted - by dealer - sale - craigslist
Hood County Buy Sell And Trade
A rough Sunday for some of the NFL's best teams in 2023 led to the three biggest upsets: Analysis - NFL
Kvta Ventura News
Navy Female Prt Standards 30 34
Pizza Hut In Dinuba
Mals Crazy Crab
Adam4Adam Discount Codes
Red Devil 9664D Snowblower Manual
Earl David Worden Military Service
Concordia Apartment 34 Tarkov
Teacup Yorkie For Sale Up To $400 In South Carolina
Transactions (zipForm Edition) | Lone Wolf | Real Estate Forms Software
Riherds Ky Scoreboard
Isaidup
Optum Urgent Care - Nutley Photos
Terry Bradshaw | Biography, Stats, & Facts
پنل کاربری سایت همسریابی هلو
Regina Perrow
Mikayla Campinos: Unveiling The Truth Behind The Leaked Content
John Deere 44 Snowblower Parts Manual
Motor Mounts
James Ingram | Biography, Songs, Hits, & Cause of Death
Aladtec Login Denver Health
Beth Moore 2023
#scandalous stars | astrognossienne
Truckers Report Forums
Barrage Enhancement Lost Ark
Bimmerpost version for Porsche forum?
3302577704
When His Eyes Opened Chapter 2048
Google Flights Orlando
Final Fantasy 7 Remake Nexus
Ukraine-Krieg - Militärexperte: "Momentum bei den Russen"
Nail Salon Open On Monday Near Me
Alpha Labs Male Enhancement – Complete Reviews And Guide
Makes A Successful Catch Maybe Crossword Clue
Oakley Rae (Social Media Star) – Bio, Net Worth, Career, Age, Height, And More
Union Supply Direct Wisconsin
Cool Math Games Bucketball
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.