macfuseというかmacfuseとsshfs。 ssh越しでリモートサーバのフォルダをマウントできるようになる。
まずhomebrew caskのインストール
$ brew install caskroom/cask/brew-cask
macfuseとsshfsのインストール
$ brew cask install osxfuse $ brew cask install sshfs
まずmacfuseをインストール。portsでもいいんだろうけどなんかバージョン低いんで、 ここからダウンロード。してインストール。
お次ぎにsshfs。これもportsでよさそうだけどダウンロードしてみる。 sshfsのサイトのsshfs-static-leopard.gzとかをダウンロード。tigerのもある。
$ wget http://osxbook.com/download/sshfs/sshfs-static-leopard.gz $ gunzip sshfs-static-leopard.gz $ mv sshfs-static-leopard /usr/bin/sshfs $ sudo chmod +x /usr/bin/sshfs
portsでやるなら
$ sudo port install macfuse $ sudo port install sshfs
だけかも。
マウント用ディレクトリ作成
$ mkdir -p ~/mnt/testfs
んでまうんと。 リモートサーバのuserがcentos,hostがexample.jpの場合。
$ sshfs centos@example.jp:/home/centos ~/mnt/testfs
でもsshのポートを22から変えていたりしたら繋がらない。ので~/.ssh/configに
$ vi ~/.ssh/config Host cent-server HostName example.jp Port 11122 Protocol 2
とかPortを指定してから
$ sshfs centos@cent-server:/home/centos ~/mnt/testfs
とconfigで作ったHost名でやると繋がる。
ちなみに。macfuseのページだと
$ sshfs user@host:/some/directory /some/mount/point -oauto_cache,reconnect,volname=<volname>
こうやれと書いてある。のでこの場合は
$ sshfs centos@cent-server:/home/centos ~/mnt/testfs -oauto_cache,reconnect,volname=cent-server