Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

To mount a remote file system through SSH on Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Learn the steps to mount a remote file system through SSH on Linux? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

SSHFS is a file system based on SSH File transfer Protocol (SFTP). On the remote side, we only need to install the SSH server, because most SSH servers already support this, so there is nothing to do on the remote server except to install the SSH server. On the client side, we need to install the fuse sshfs package to mount the remote file system.

Characteristics of SSHFS:

Based on FUSE (Linux's Best user Space File system Framework)

Multithreading: there can be multiple requests on the server

Allow large reads (maximum 64k)

Cache directory contents

Step 1: install fuse-sshfs

For centos/rhel users, fuse sshfs is available under epel repository, so make sure that epel repository is installed on the system. Now execute the following command to install it

On CENTOS/RHELL:

# yum install fuse-sshfs

On Ubuntu and Dabian:

$sudo apt-get update $sudo apt-get install sshfs

Step 2: Mount the remote directory

Let's mount the remote server directory using sshfs to ensure that the ssh server running on the remote system is connected correctly to the ssh of the system.

First create the mount point

# mkdir / mntssh

Let's mount the remote directory. For this example, we will install the / home/remoteuser directory from the 192.168.1.12 (remote.example.com) system to the local system.

# sshfs laitkor@remote.example.com:/home/remoteuser / opt/mntssh

Sample output

The authenticity of host 'remote.example.com (192.168.1.12)' can't be established.RSA key fingerprint is 77:85:9e:ff:de:2a:ef:49:68:09:9b:dc:f0:f3:09:07.Are you sure you want to continue connecting (yes/no)? Yesremoteuser@remote.example.com's password:

Step 3: verify the installation

After mounting the remote file system on the local mount point, verify it by running the mount command.

# mount/dev/mapper/vg_svr1-lv_root on / type ext4 (rw) proc on / proc type proc (rw) sysfs on / sys type sysfs (rw) devpts on / dev/pts type devpts (rw,gid=5,mode=620) tmpfs on / dev/shm type tmpfs (rw) / dev/sda1 on / boot type ext4 (rw) remoteuser@remote.example.com:/home/remoteuser on / mntssh type fuse.sshfs (rw,nosuid,nodev)

Also navigate to your mount point and you will see the file from the remote system

# cd / mntssh# ls

Step 4: Mount the directory when the system boots

If you want to automatically mount the remote file system each time the system reboots, add the following entry in the / etc / fstab file. Ensure that key-based ssh is installed between the remote and local systems.

Remoteuser@remote.example.com:/home/remoteuser / mntssh fuse.sshfs defaults 0 0

Step 5: uninstall the directory

If your work is done and you no longer need the installed directory, simply uninstall it using the following command.

# umount / mntssh Thank you for reading! After reading the above, do you have a general idea of the steps to mount a remote file system through SSH on Linux? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report