Announcement

Collapse
No announcement yet.

How to Setup and Use Sshfs in Linux

Collapse
X
Collapse
  •  

  • How to Setup and Use Sshfs in Linux



    The SSH File System, or SSHFS, is a filesystem client that you can mount on your local device to interact with files on the remote device. SSH establishes this connection using the Secure Shell File Transfer Protocol (SFTP).
    Moreover, using its cryptographic protocol, SSH ensures data integrity and confidentiality. If your daily tasks include administrating a remote device or server, you are bound to use SSHFS. Hence, you need to learn how to use the SSH File System. So, this short guide will demonstrate how to set up and use SSHFS without much effort.
    How to Setup and Use SSHFS

    You can install SSHFS on both your local and remote devices. Most Linux distributions, such as Ubuntu, Fedora, RHEL, etc., include SSHFS in their package repositories. Start by updating the package list and upgrading installed packages using the following commands:




    Operating System Command
    Debian/Ubuntu sudo apt update && sudo apt upgrade
    CentOS/Fedora/RHEL sudo dnf check-update && sudo dnf update
    Arch Linux sudo pacman -syu
    openSUSE sudo zypper update
    Now, execute one of the below commands according to your distributions. Note that RHEL-based systems identify this utility as fuse-sshfs.
    Operating System Command
    Debian/Ubuntu sudo apt install sshfs
    CentOS/Fedora/RHEL sudo dnf install fuse-sshfs
    Arch Linux sudo pacman -S sshfs
    openSUSE sudo zypper install sshfs
    After installing the utility, proceed to mount the remote directory using the ‘sshfs’ command as follows:

    sshfs user@remote_server:/path/to/remote/directory /path/to/mount



    Here, replace user with your username on the remote system, remote_server with the IP address or the hostname of the remote server, /path/to/remote/directory with the directory you intend to mount from the remote server, and /path/to/mount with the location where you want to mount it on the local device. Let’s look at an example:
    sshfs prateek@geekie.com:/home/prateek /local/backup




    If you execute the sshfs command for the first time, the system will ask you to enter the password. SSHFS will mount your desired remote directory locally at the specified mount point upon successful authentication. When you are done, you can unmount the remote directory using:
    unmount /path/to/mount


    In the above command, /path/to/mount indicates the path you mount the directory in the earlier steps. With the above step, you have successfully set up SSHFS. However, the remote directory will unmount when you shut down your system.
    If you want to mount any specific directory automatically with every system boot, add an entry in the /etc/fstab file. However, you would need to have root privileges. For instance, follow the below steps to auto-mount a remote directory using SSHFS. Open the file using a text editor– nano /etc/fstab


    Append into it:
    user@remote_server:/path/to/remote/directory /path/to/mount fuse.sshfs defaults,_netdev 0 0


    Finally, save and exit the editor to save the entry.
    Wrapping Up

    This is how you can set up and use SSHFS in your Linux system to access the remote server without hassles. SSHFS is nothing but a filesystem client that you can use to mount on your local device and access the remote server. If you are a beginner, we recommend that you use the commands correctly, or else you may face errors while setting up the connection.



    More...
      Posting comments is disabled.

    Categories

    Collapse

    Article Tags

    Collapse

    There are no tags yet.

    Latest Articles

    Collapse

    • HAProxy on Ubuntu: Load Balancing and Failover for Resilient Infrastructure
      by Kasimba



      by german.suarez


      Introduction

      In today’s fast-paced digital landscape, ensuring the availability and performance of applications is paramount. Modern infrastructures require robust solutions to distribute traffic efficiently and maintain service availability even in the face of server failures. Enter HAProxy, the de facto standard for high-performance load balancing and failover.


      This article...
      Today, 03:00 PM
    • Providing a license for package sources
      by Kasimba
      Arch Linux hasn't had a license for any package sources (such as PKGBUILD files) in the past, which is potentially problematic. Providing a license will preempt that uncertainty.

      In RFC 40 we agreed to change all package sources to be licensed under the very liberal 0BSD license. This change will not limit what you can do with package sources. Check out the RFC for more on the rationale and prior discussion.

      Before we make this change, we will provide contributors with...
      11-19-2024, 09:21 AM
    • Linux Binary Analysis for Reverse Engineering and Vulnerability Discovery
      by Kasimba



      by George Whittaker


      Introduction

      In the world of cybersecurity and software development, binary analysis holds a unique place. It is the art of examining compiled programs to understand their functionality, identify vulnerabilities, or debug issues—without access to the original source code. For Linux, which dominates servers, embedded systems, and even personal computing, the skill of binary analysis is...
      11-18-2024, 07:10 PM
    • Ubuntu vs Debian: Linux Distributions Compared Deep Dive
      by Kasimba
      Debian and Ubuntu are two popular Linux distributions. In this deep dive we will guide you on the key differences between them from perspective of both corporate enterprise and personal productivity or pleasure usage. After reading this blog post you should be in a better position to decide to select Ubuntu or Debian.
      Stewardship, Licensing, Community and Cost

      Where as Debian is 100% fully committed to free software as defined by the Debian Free Software Guidelines, Ubuntu is created...
      11-17-2024, 08:30 PM
    • Debian Backup and Recovery Solutions: Safeguard Your Data with Confidence
      by Kasimba



      by George Whittaker


      Introduction

      In the digital age, data loss is a critical concern, and effective backup and recovery systems are vital for any Debian system administrator or user. Debian, known for its stability and suitability in enterprise, server, and personal computing environments, offers a multitude of tools for creating robust backup and recovery solutions. This guide will explore these solutions,...
      11-13-2024, 05:30 PM
    • Installing Development Tools on Debian: Setting Up Compilers, Libraries, and IDEs for a Robust Development Environment
      by Kasimba



      by George Whittaker


      Introduction

      Debian is one of the most trusted and stable Linux distributions, making it a top choice among developers and system administrators. Setting up a powerful development environment on Debian involves installing the right tools, compilers, libraries, and Integrated Development Environments (IDEs) that can support various programming languages and workflows. This guide provides...
      11-07-2024, 11:22 PM
    Working...
    X