SSHでマウント
http://tech.ckme.co.jp/ssh_sshfs.shtml
http://www.atmarkit.co.jp/flinux/rensai/linuxtips/948sshfs.html
sshfs を使うとsshサーバをマウントする事が出来る。
インストール
sshfs がインストールされていない場合は
# yum install fuse-sshfs
リポジトリに fuse-sshfs がない場合は、RPMforgeをリポジトリに追加する。
準備
/etc/groupにsshfsを使用するユーザー名を登録する。複数のユーザーを登録する場合は、カンマで区切る。
fuse:x:104:test
マウント
$ sshfs 192.168.0.30: ~/mnt $ sshfs foo@192.168.0.30:/home/foo ~/mnt
アンマウント
$ fusermount -u /home/nori/mnt
オプション
allow_other
マウントしたユーザ以外のユーザも使えるようにする
例:
sshfs foo@192.168.0.30:/home/foo ~/mnt -o allow_other
umask
umaskを指定できるが、ファイルとディレクトリに対して異なるmaskは指定できない。
sshfs foo@192.168.0.30:/home/foo ~/mnt -o allow_other,umask=002
IdentityFile
sshの鍵を指定する
例:
sshfs foo@192.168.0.30:/home/foo ~/mnt -o allow_other -o IdentityFile=/hoge/ssh_key
fstab の書き方
sshfs#root@10.232.139.234:/mnt/files /var/www/remote_files fuse allow_other,IdentityFile=/path/to/my_ssh_keyfile 0 0
CentOS 5.2 の場合
yum-prioritiesをインストール
# yum install yum-priorities
/etc/yum.repos.d/CentOS-Base.repo内の書くセクションの最後に、
priority=1
GPGキーをインストール
# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
リポジトリをインストール
# rpm -ivh http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
sshfsをインストール
# yum install fuse-sshfs --enablerepo=extras
modprobe fuseとすると、
# modprobe fuse FATAL: Module fuse not found.
の様にエラーになってしまうので
dkms-fuseもインストールする
yum install dkms-fuse
そして
# modprobe fuse
で使えるようになる。
[通知用URL]
Tweet
最終更新時間:2017年08月23日 19時22分47秒