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

    • 5 Compelling Reasons to Choose Linux Over Windows
      by Kasimba



      by George Whittaker


      Introduction

      In the world of operating systems, Windows has long held the lion’s share of the market. Its user-friendly interface and wide compatibility have made it the default choice for many. However, in recent years, Linux has steadily gained traction, challenging the status quo with its unique offerings. What was once considered the domain of tech enthusiasts and developers is now...
      Yesterday, 06:52 AM
    • NGINX vs Apache; Web Server Comparison
      by Kasimba
      Overview of NGINX and Apache

      NGINX and Apache are leading web server solutions utilized for hosting websites and web applications. Apache, developed by the Apache Software Foundation, offers robust configuration options and extensibility. NGINX, created by Igor Sysoev, is known for its efficiency in handling numerous concurrent connections with low resource utilization. Both servers function not only as HTTP servers but also as reverse proxies, load balancers, and more.

      What is

      ...
      Yesterday, 03:54 AM
    • Monthly News – November 2024
      by Kasimba
      Hi everyone, I hope you are enjoying the BETA so far! This release introduces new features, tools, and artwork, so we anticipate a good number of bug reports. Every single fix helps us refine and improve the final release. Your feedback during the BETA phase is extremely important to us. Linux Mint 22.1 is our […]

      More...
      12-16-2024, 11:50 AM
    • Mastering OpenSSH for Remote Access on Debian Like a Pro
      by Kasimba



      by George Whittaker


      Introduction

      Remote access is a cornerstone of modern IT infrastructure, enabling administrators and users to manage systems, applications, and data from virtually anywhere. However, with great power comes great responsibility—ensuring that remote access remains secure is paramount. This is where OpenSSH steps in, providing robust, encrypted communication for secure remote management....
      12-13-2024, 10:31 PM
    • Unlocking the Full Potential of Linux's Most Versatile Search Tool
      by Kasimba



      by George Whittaker


      Introduction

      The grep command, short for "global regular expression print," is one of the most powerful and frequently used tools in Unix and Linux environments. From sifting through log files to finding patterns in text, grep is a Swiss Army knife for system administrators, developers, and data analysts alike. However, many users limit themselves to its basic functionality, unaware...
      12-13-2024, 09:24 PM
    • Linux Mint 22.1 “Xia” – BETA Release
      by Kasimba
      This is the BETA release for Linux Mint 22.1 “Xia”. Linux Mint 22.1 is a long term support release which will be supported until 2029. It comes with updated software and brings refinements and many new features to make your desktop even more comfortable to use. New features: This new version of Linux Mint contains […]

      More...
      12-12-2024, 09:31 AM
    Working...
    X