Support Online
Skip to main content

Using SSHFS: Mounting Remote File Systems Over SSH

🎯 What You Will Learn in This Guide

This guide teaches you how to mount a directory on a remote server to your local system using the SSHFS (SSH File System) tool.
You will learn to access large data sets with just SSH security, without the need for complex configurations such as NFS or SMB, and to apply performance optimizations, especially in AI/ML projects.
You will also see step by step methods /etc/fstab and systemd to make the connection permanent.


🧠 Phase 1 – Technical Summary

Main Technical Topic: SSHFS is a FUSE (Userspace File System) based tool and mounts remote directories to the local system using the SSH protocol.
Solved Problem: In methods such as SCP/SFTP, it is only possible to copy files. SSHFS, on the other hand, provides real-time access to the entire file system.
Steps Followed:

  1. SSHFS installation
  2. Create a local mount point
  3. Connecting with advanced connection parameters
  4. Creating a persistent configuration
    Brief Technical Summary: With SSHFS, you can access files on remote servers from the local system and work safely and quickly with large data sets.

⚙️ 1. SSHFS Installation and Requirements

Requirements

  • Two Linux systems: one local, the other remote (SSH access enabled).
  • SSH key authentication: The key must be configured for passwordless login.
  • FUSE support: Comes by default in modern distributions.

Ubuntu/Debian

sudo apt update
sudo apt install sshfs fuse3

📝 This command installs SSHFS and FUSE components.

RHEL/Fedora


sudo dnf install sshfs fuse-sshfs

Verifying the Installation


sshfs --version

🧠 If you see SSHFS version in the output, the installation has been completed successfully.


🔗 2. Mounting Remote File System

Creating a Mount Point


sudo mkdir /mnt/yz_veri_seti

💡 Recommendation: Use meaningful folder names based on data type (e.g. /mnt/ml_datasets).

Basic Bind Command


sudo sshfs -o allow_other,default_permissions genixnode@tr1-node01:~/ /mnt/yz_veri_seti

Description:

allow_other: Allows other users to access.

default_permissions: Implements the standard Linux permission system.

genixnode@tr1-node01:~/: Source (remote system path).

/mnt/yz_data_set: Target (local mount point).

Performance-Oriented Binding for AI/ML


sudo sshfs -o allow_other,default_permissions,compression=yes,cache=yes,auto_cache,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 \
genixnode@gpu_sunucu:/datasets /mnt/yz_veri_seti
OptionDescriptionBenefit
compression=yesIt compresses the data.Reduces bandwidth usage.
cache=yes,auto_cacheActivates caching.It increases reading speed.
reconnectIf the connection is lost, it tries again.Provides stable connection over long periods.
ServerAliveInterval=15It sends a control signal every 15 seconds.Maintains connection continuity.

Verifying and Detaching the Connection Check the connection:


mount | grep sshfs

To separate safely:


sudo umount /mnt/yz_veri_seti

⚠️ Warning: Always umount before shutting down the system.


💾 3. Persistent Mount

via /etc/fstab


sudo nano /etc/fstab

Add this line at the end:


genixnode@gpu_sunucu:/datasets /mnt/yz_veri_seti fuse.sshfs noauto,x-systemd.automount,_netdev,reconnect,identityfile=/home/genixnode/.ssh/id_rsa,allow_other,default_permissions,compression=yes,cache=yes,auto_cache 0 0

Parameter Descriptions:

noauto: It does not connect automatically at system startup.

x-systemd.automount: Mounts on first access.

_netdev: Prevents connecting without initializing the network.

identityfile: Specifies the SSH key path.

To test the configuration:


sudo mount -a

⚙️ 4. Frequently Asked Questions (FAQ)

1. Why should SSHFS be preferred?

Because it provides file system integrity compared to SCP or SFTP. Real-time access to remote directories is possible with SSHFS.

2. What to do if there is slowness when using SSHFS?

Speed can be increased with flags such as compression=yes, cache=yes, auto_cache. Network latency is the most important factor.

3. Is it possible to connect without asking for a password?

Yes. SSH key authentication must be installed.

4. What happens if the system shuts down without umounting?

If the connection is interrupted unexpectedly, data loss may occur. Always run sudo umount.

5. How to make a read-only connection?


sshfs -o ro,allow_other genixnode@sunucu:/veri /mnt/readonly

🚀 Result

SSHFS provides high security and flexibility when working with large data sets in AI/ML and cloud-based development environments. It offers uninterrupted file access by automating the connection.

💡 Try SSHFS connections on GenixNode infrastructure now; Speed ​​up data access, power your AI projects! 🚀