lost and found ( for me ? )

SSHFS

[ What’s SSHFS ]

SSHFS allows you to mount a remote machine’s directory to your local machine via SSH connection.

[ install ]
# apt-get install sshfs


add a user to fuse group.
# gpasswd -a $USER fuse
ユーザ zzzz をグループ fuse に追加


[ usage ]

on local machine , crate a directory for a mount point.
# mkdir /root/tmp_dir


mount
# sshfs -o idmap=user root@192.168.10.14:/root /root/tmp_dir
root@192.168.10.14's password:


this example is mounting a remote machine’s (192.168.10.14)  “/root “ directory to your local directory “/root/tmp_dir”

-o idmap option.
      -o idmap=TYPE
             user/group ID mapping, possible types are:
              none   no translation of the ID space (default)
              user   only translate UID of connecting user

# mount | egrep “192”
root@192.168.10.14:/root on /root/tmp_dir type fuse.sshfs (rw,nosuid,nodev,max_read=65536)


unmount
# fusermount -u tmp_dir


[ how to remount automatically when you get disconnected or terminated for some reason ]

install autossh
# apt-cache search autossh
autossh - Automatically restart SSH sessions and tunnels

# apt-get install autossh


add “ssh_command=autossh” option:
# sshfs -o idmap=user root@192.168.10.14:/root /root/tmp_dir -o ssh_command=/usr/bin/autossh

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.