SSHFS的特點:
基于FUSE(Linux的最佳用戶空間文件系統(tǒng)框架)
多線程:在服務器上可以有多個請求
允許大讀?。ㄗ畲?4k)
緩存目錄內容
步驟1:安裝fuse-sshfs
對于centos/rhel用戶,fuse sshfs在epel repository下可用,因此請確保在系統(tǒng)中安裝了epel repository?,F在執(zhí)行以下命令安裝它
在CENTOS/RHELL上:
在Ubuntu和Dabian上:
$ sudo apt-get update
$ sudo apt-get install sshfs
步驟2:裝載遠程目錄
讓我們使用sshfs掛載遠程服務器目錄,確保遠程系統(tǒng)運行的ssh服務器與系統(tǒng)的ssh連接正確。
首先創(chuàng)建裝入點
讓我們掛載遠程目錄。對于本例,我們將把/home/remoteuser目錄從192.168.1.12(remote.example.com)系統(tǒng)安裝到本地系統(tǒng)。
# sshfs laitkor@remote.example.com:/home/remoteuser /opt/mntssh
樣本輸出
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)? yes
remoteuser@remote.example.com's password:
步驟3:驗證安裝
在本地掛載點上掛載遠程文件系統(tǒng)后,通過運行mount命令進行驗證。
# 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)
同樣導航到你的掛載點,將從遠程系統(tǒng)中看到文件
步驟4:在系統(tǒng)引導時掛載目錄
如果要在每次系統(tǒng)重新引導時自動掛載遠程文件系統(tǒng),請在/ etc / fstab文件中添加以下條目。確保在遠程和本地系統(tǒng)之間安裝了基于密鑰的ssh。
remoteuser@remote.example.com:/home/remoteuser /mntssh fuse.sshfs defaults 0 0
步驟5:卸載目錄
如果您的工作結束并且您不再需要已安裝的目錄,則只需使用以下命令卸載。