linux操作集-SSHFS进行远程目录挂载实现日志堡垒机

2018-11-28  本文已影响26人  爱编程的凯哥

需求介绍

日志堡垒机,挂载生产日志目录。常用挂载还有nfs(但这种个人感觉较麻烦,有机会介绍),但感觉sshfs挺强大点,重要是配置简单

centos上可以通过rpm包(其他系统可以根据我上篇文章地址进行下载):
wget http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el7/en/x86_64/rpmforge/RPMS/fuse-sshfs-2.5-1.el7.rf.x86_64.rpm

最简单是通过yum安装
yum install sshfs

sshfs -o ro root@47.93.00.00:/apps/log/tomcat-nohup   /apps/my-log
*  root@47.93.00.00。账号@IP
* /apps/log/tomcat-nohup  远程地址
*  /apps/my-log 本地地址
* ro 只读

此时会要你输入密码,输完密码就ok了。
当然也可以配置授权登陆的方式

sudo sshfs -o allow_other,IdentityFile=~/.ssh/id_rsa tecmint@x.x.x.x:/home/tecmint/ /mnt/tecmint
image.png

此时就表示成功了。

umount 你本地目录

Linux操作集目录 https://www.jianshu.com/p/7839d27c62f8

上一篇 下一篇

猜你喜欢

热点阅读