티스토리 뷰

출처 : blog.leocat.kr/notes/2018/04/23/sshfs-mount-remote-server-using-ssh

 

이 문서는 단순 참고용이며, 자세한 내용은 다루고 있지 않으니, 위의 출처에서 자세한 내용을 확인 하시기 바랍니다.

 

준비 : '백업 서버' 와 '로컬 서버' 둘다 ssh 서비스가 동작중이어야 한다.

목적 : '로컬 서버' 의 특정 사용자 계정으로 '백업 서버' 를 sshfs 로 마운트 한다.

 

[ 백업 서버 : 192.168.0.1 ] 

root@freecatz-nas:~# mkdir -p /var/sshfs
root@freecatz-nas:~# useradd sshfs -d /var/sshfs
root@freecatz-nas:~# passwd sshfs
새 UNIX 암호 입력: 
새 UNIX 암호 재입력: 
root@freecatz-nas:~# chown sshfs /var/sshfs/
root@freecatz-nas:~# chgrp sshfs /var/sshfs/

 

[ 로컬  서버 : 192.168.0.2 ] 

root@freecatz-pe-kr:~# apt-cache search sshfs
4pane - four-pane detailed-list file manager
backintime-common - simple backup/snapshot system (common files)
sshfs - filesystem client based on SSH File Transfer Protocol
vagrant-sshfs - vagrant plugin that adds synced folder support with sshfs
root@freecatz-pe-kr:~# apt-get install sshfs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  fuse
The following NEW packages will be installed:
  fuse sshfs
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 118 kB of archives.
After this operation, 268 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y

... 길어서 중략 ...

root@freecatz-pe-kr:~# su - freecatz

freecatz@freecatz-pe-kr:~$ mkdir ~/sshfs

freecatz@freecatz-pe-kr:~$ sshfs -o reconnect -p 9999 sshfs@192.168.0.1:/var/sshfs /home/freecatz/sshfs

freecatz@freecatz-pe-kr:~$ mount

... 길어서 중략 ...

tmpfs on /run/user/1002 type tmpfs (rw,nosuid,nodev,relatime,size=101360k,mode=700,uid=1002,gid=1002)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)

sshfs@192.168.0.1:/var/sshfs on /home/freecatz/sshfs type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=1001,group_id=1001)

freecatz@freecatz-pe-kr:~$ sudo umount /home/freecatz/sshfs

freecatz@freecatz-pe-kr:~$ df -h
Filesystem                               Size  Used Avail Use% Mounted on
... 길어서 중략 ...
tmpfs                                       99M      0   99M   0% /run/user/1001
tmpfs                                       99M      0   99M   0% /run/user/1002
sshfs@192.168.0.1:/var/sshfs   98G  5.2G   88G   6% /home/freecatz/sshfs

 

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함