How To Mount a Remote Directory With SSHFS on a Linux

https:‮ww//‬w.lautturi.com
How To Mount a Remote Directory With SSHFS on a Linux

To mount a remote directory with SSHFS on a Linux system, you can use the sshfs utility.

Here is a general outline of the steps you can follow:

  1. Install the sshfs package on your Linux system. On Ubuntu or Debian systems, you can install sshfs by running the following command:
apt-get install sshfs

On CentOS or Fedora systems, you can install sshfs by running the following command:

yum install sshfs
  1. Create a mount point for the remote directory. You can do this by running the mkdir command. For example, to create a mount point at /mnt/remote, run the following command:
mkdir /mnt/remote
  1. Mount the remote directory. You can do this by running the sshfs command, followed by the username and hostname of the remote server, and the path to the remote directory. Here is an example of how to mount a remote directory at /mnt/remote:
sshfs user@server:/path/to/remote/directory /mnt/remote

Replace user with the username on the remote server, server with the hostname or IP address of the remote server, and /path/to/remote/directory with the path to the remote directory you want to mount.

  1. (Optional) Add the mount point to the system's fstab file to make it persistent across reboots. To do this, add the following line to the /etc/fstab file:
user@server:/path/to/remote/directory /mnt/remote sshfs defaults,_netdev 0 0

Replace user with the username on the remote server, server with the hostname or IP address of the remote server, and /path/to/remote/directory with the path to the remote directory you want to mount.

That's it! You now know how to mount a remote directory with SSHFS on a Linux system.

Note: You may need to modify the steps depending on your specific setup and requirements. Additionally, make sure that you have permission to access the remote directory and that you have the correct SSH credentials.

Created Time:2017-10-16 14:38:43  Author:lautturi