SSHFSのインストール

前提

まずFUSEをインストールする。

ソース

ここから。http://fuse.sourceforge.net/sshfs.html

SPECファイル

 Summary: sshfs
 Name: sshfs-fuse
 Version: 2.2
 Release: 1
 Source0: %{name}-%{version}.tar.gz
 Group: System Environment/Base
 License: GPL
 BuildRoot: %{_builddir}/%{name}-root
 %description
 SSHFS http://fuse.sourceforge.net/sshfs.html
 %define prefix /usr/local
 %prep
 %setup -q
 %build
 ./configure --prefix=%{prefix}
 make
 %install
 rm -rf $RPM_BUILD_ROOT
 make DESTDIR=$RPM_BUILD_ROOT install
 %clean
 rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-,root,root)
 %{prefix}/bin/sshfs
 %{prefix}/lib/sshnodelay.so
 %{prefix}/share/man/man1/sshfs.1

起動時にマウント

/etc/fstabでオートマウントすることも出来るが、使い勝手が悪いので(http://linux.mini13i.gotdns.org/filesystem%2Fsshfs.htmlを参考の事)、ランコンスクリプトでマウントするようにする。 以下が/etc/rc.d/init.d/sshfsの内容。

 #!/bin/bash
 # chkconfig: 345 99 01
 # description: mount/umount sshfs filesyttem
 
 PATH=/usr/local/bin:$PATH
 
 case "$1" in
     start)
         su -l taro -c "sshfs 192.168.0.1:/home/taro /home/taro/mnt"
         ;;
     stop)
         su -l taro -c "fusermount -u /home/taro/mnt"
         ;;
     restart)
         $0 stop
         $0 start
         ;;
     *)
         echo "Usage: $0 {start|stop|restart}"
         exit 1
 esac
 
 exit 0

一般ユーザでパーミッションがない場合

 chmod +x /bin/fusermount

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS

Last-modified: 2013-02-25 (月) 01:04:42