LoginSignup
14
11

More than 5 years have passed since last update.

SSHFSの設定の備忘録

Last updated at Posted at 2015-09-27

TL;DR

SSHのプロトコル使って、リモートのFSをMacにマウントしたい時のSSHFSの設定の備忘録

インスコ(ubuntu)

項目
ubuntu sudo apt-get install sshfs

インスコ(mac)

項目
brewから brew install sshfs
#URLから入れろとエラー
osxfuseのインストール http://sourceforge.net/projects/osxfuse/files/
#URLからDLしてinstall
sshfsのインストール https://github.com/osxfuse/sshfs/downloads
#URLからDLしてinstall
確認 sshfs --version

sshfsの基本

項目
マウントポイントの作成 mkdir mountpoint
マウント sshfs [-p port] [user]@[hostname]:[/path/to/dir] mountpoint /local/mountpath/
秘密鍵指 定マウント sshfs [-p port] [user]@[hostname]:[/path/to/dir] -o IdentityFile=~/.ssh/id_rsa mountpoint /local/mountpath/
sshのconfigのblogを読み込みマウント sshfs blog: ~/local/mountpoint
おすすめマウント方法 sshfs blog: ~/local/mountpoint/ -oauto_cache,reconnect,defer_permissions,noappledouble,negative_vncache,volname=manual #Note: カンマの前に空白はダメ
アンマウント diskutil unmount mountpoint/

Vagrantを使う場合

$ cd $project_directory
$ vagrant up # vagrantの立ち上げ
$ vagrant ssh-config >> ~/.ssh/config # sshの設定追加
$ mkdir ./mountpoint # マウントポイント用のフォルダを作成
$ sshfs XXX:/ ./mountpoint/ -oauto_cache,reconnect,noappledouble,negative_vncache,volname=MP
$ # NOTE: 
$ # - 第一引数のXXXはSSHのHOST名で、:/のスラッシュはXXXのルートディレクトリをマウントすることを意味する
$ # - 第二引数の./mountpoint/はマウントするフォルダを指定している
$ # - ルートディレクトリでdefer_permissionsを行なうと応答が帰ってこなくなるので、オプションから除く必要がある

参考文献

http://qiita.com/xxthermidorxx/items/bb148530a55a4e55d99b
http://unix.stackexchange.com/questions/61567/sshfs-specify-key
http://blog.philippklaus.de/2011/07/sshfs-on-mac-os-x-10-6-8-with-fuse4x/
http://superuser.com/questions/549261/on-linux-how-do-i-prevent-the-creation-of-ds-store-files--
http://eddmann.com/posts/mounting-an-osx-ssh-volume-using-fuse-and-sshfs/
https://stackoverflow.com/questions/14870900/how-to-find-the-vagrant-ip

14
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
11