通过sshfs实现使用本地IDE工具编辑远程服务器的文件
场景描述:1. 需要编辑远程服务器的文件, 实时生效。
本地电脑: mac pro
远程服务器: Centos7 无GUI界面, 支持ssh 远程登陆.
好处:对于大型的配置文件,特别是yaml,.sh 文件,可用语法显示,方便排错,
可用使用idea 强大的工具,界面非常友好.
解决办法:
安装sshfs 工具:
1.Mac 电脑:
brew install sshfs
- 如果是Centos
yum install sshfs -y
通过SSH挂载文件夹/文件系统
sshfs [email protected]:/var/server/ ~/server/tmp3
cd ~/server/tmp3
idea jenkins.sh
语法格式如下:
sshfs [email protected]:/path/to/folder /path/to/mount/point
直接从命令行里打开 jenkins.sh
pc jenkins.sh
上面的pc 是命令简写,
在我的环境配置里 ~/.bash_profile
alias pc=’/usr/local/bin/charm’