假设已经在日志分析机器上安装了文件挂载软件 ,也假设之前已经建立了文件夹。1. 在命令行
cd /mnt/ fusermount -u share 或 fusermount -u /mnt/share (会提示命令有误) umount -l /mnt/share 或 umount -l share (这个命令顶用) cd /mnt/share (成功的话,就意味着已经解锁了) sshfs root@192.168.56.14:/var/log/nginx/he /mnt/share sshfs root@192.102.*.*:/var/log/***/111 /mnt/share (挂载命令)
2.安装sshfs 并建立文件夹
apt-get install sshfs (ubuntu)
find / -name sshfs mkdir ... + chmod ... 3.centos下安装sshfswget it
wget http://sourceforge.net/projects/fuse/files/fuse-2.X/2.8.7/fuse-2.8.7.tar.gzuntar
tar zxf fuse-2.8.7.tar.gzcd into the dir
cd fuse-2.8.7be root
sudo suor
su -configure, make, make install
./configure;make;make installgive some libs
echo '/usr/local/lib' > /etc/ld.so.conf.d/fuse.confldconfig
ldconfiggrab sshfs from http://fuse.sourceforge.net/sshfs.html and wget the stable
wget http://sourceforge.net/projects/fuse/files/sshfs-fuse/2.4/sshfs-fuse-2.4.tar.gzuntar
tar zxf sshfs-fuse-2.4.tar.gzDo all the makes!
cd sshfs-fuse-2.4 ./configure;make;make installTurns out we have some prerequisits
Error:No package 'glib-2.0' found No package 'gthread-2.0' foundFixes
yum install glib2-develnow rerun the makes!
./configure;make;make installGood to go! Now make the mount point
mkdir /mnt/yourmom.comDone and done.
Switch back to your normal user(or if only root you may need to add /usr/local/bin/ to your path or call sshfs using the direct path) now we can mount a remote filesystem using this syntax
sshfs user@remote-address.com:/media/megabiglife /mnt/yourmom.comYou will then be prompted for the password on the remote host. Some people prefer passwordless authentication using keys, if you are looking for this, I suggest checking here http://lmgtfy.com/?q=how+to+set+up+ssh+keys
In my case, the ssh server at the remote host is running on a custom port, if anyone cares, break the logical protocol and add the port number after the sshfs command
sshfs -p 1234 user@hostname:/media/megabiglife /mnt/yourmom.comTo un mount run
umount /mnt/yourmom.comIn case it wasn't obvious, you should replace the username and hostname fields when using this tutorial. I do like the idea of yourmom.com and megabiglife mounts so that is optional.