lost and found ( for me ? )


[ 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

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

this example is mounting a remote machine’s (  “/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@ on /root/tmp_dir type fuse.sshfs (rw,nosuid,nodev,max_read=65536)

# 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@ /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.