LoginSignup
2
2

More than 5 years have passed since last update.

ssh経由でリモートサーバーのディレクトリをマウントする (CentOS6系想定)

Last updated at Posted at 2018-02-02

インストール

libfuse/sshfs を利用する
https://github.com/libfuse/sshfs

yum --enablerepo=epel -y install fuse-sshfs

マウント

#sshfs [user@]hostname:[directory] mountpoint

sshfs user@192.168.0.2:/home/data /mnt/data

自動マウント /etc/fstab

user@192.168.0.2:/home/data /mnt/data fuse.sshfs _netdev 0 0

# _netdev (ネットワークが起動してから)
# CentOS7 systemd使う場合は下記オプション必要だと思う
# x-systemd.automount

アンマウント

fusermount -u /home/foo/mnt

 
 
Mac用などもあるので個人プロジェクトでssh経由でファイルやり取りが頻繁にあるようなら、利用時だけマウントしてローカルマシンからアクセスなども需要あるかな。

2
2
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
2
2