맛집 여행 캠핑 일상 생활

[Linux] ssh 원격지 mount 방법 본문

LINUX

[Linux] ssh 원격지 mount 방법

영은파더♥ 2024. 7. 19. 13:54

rclone sftp 삽질하다가 더 쉬운 sshfs 유틸로 마운트 하는 방법이 있는걸 알았네요~

윈도우에서는 RaiDrive 유틸리티로 sftp 로 네트워크 드라이브 잡는게 편하고 리눅스는 sshfs 가 사용하기가 편할것 같습니다.

비밀번호 입력없이 인증키로 원격지에 접속된다는 가정하에 진행합니다.

[root@itrooms test]# yum install sshfs

================================================================================
 Package            Architecture   Version               Repository        Size
================================================================================
Installing:
 fuse-sshfs         aarch64        3.7.3-1.el9           epel              61 k
Installing dependencies:
 fuse-common        aarch64        3.10.2-8.el9          baseos           7.3 k
 fuse3              aarch64        3.10.2-8.el9          appstream         52 k
 fuse3-libs         aarch64        3.10.2-8.el9          appstream         88 k

Transaction Summary
================================================================================
Install  4 Packages

Total download size: 209 k
Installed size: 655 k
Is this ok [y/N]: y

[root@itrooms test]# mkdir /mnt/sshdir

[root@itrooms test]# sshfs -o reconnect root@10.0.0.130:/home /mnt/sshdir

[root@itrooms test]# ls -l /mnt/sshdir/
total 8
drwx------ 1 rocky       rocky       95 Jul 18 15:57 rocky

[root@itrooms test]# df -h
Filesystem              Size  Used Avail Use% Mounted on
devtmpfs                4.0M     0  4.0M   0% /dev
tmpfs                    12G   12K   12G   1% /dev/shm
tmpfs                   4.7G  463M  4.2G  10% /run
/dev/mapper/rocky-root   99G   45G   55G  46% /
/dev/sda2               994M  463M  532M  47% /boot
/dev/sda1                99M  7.3M   92M   8% /boot/efi
tmpfs                   2.4G     0  2.4G   0% /run/user/0
root@10.0.0.130:/home    49G   16G   34G  32% /mnt/sshdir

[root@itrooms test]# dd if=/dev/zero of=/mnt/test/1G bs=1M count=1000 status=progress
954204160 bytes (954 MB, 910 MiB) copied, 5 s, 191 MB/s
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 5.51623 s, 190 MB/s

[root@itrooms test]# umount /mnt/sshdir

속도가 생각보다 엄청 빠른듯합니다.

 

Trackback : | Comments :