使用vscode写shell脚本
1、下载vscode
https://az764295.vo.msecnd.net/stable/f80445acd5a3dadef24aa209168452a3d97cc326/VSCodeUserSetup-x64-1.64.2.exe
百度网盘下载地址
链接:https://pan.baidu.com/s/1BPk9tDoCXRCifobY_0f0Xw
提取码:aiib
--来自百度网盘超级会员V6的分享
2、安装vscode
- 双击安装,下一步即可
- 安装完成后点开,会自动安装简体中文扩展
3、下载安装remote-ssh扩展
![](https://img-blog.csdnimg.cn/img_convert/0d4818b6a101ca5b73dda8960ac527f5.png)
在搜索那里搜索remote-ssh,安装。
4、基本配置
![](https://img-blog.csdnimg.cn/img_convert/d3002c08913ca6c5705b2b152a3c9678.png)
![](https://img-blog.csdnimg.cn/img_convert/e468b2f6323e285cd6bb2a5ec2683ff3.png)
![](https://img-blog.csdnimg.cn/img_convert/2442d3f408de76f2257a2e5cd62aa034.png)
host 填写别名
hostname 填写服务器IP地址
user 填写登录使用的用户名,我这就是root
#编辑完成后保存退出
![](https://img-blog.csdnimg.cn/img_convert/549c1d82d77f7d11f72ce539d5fd8bd6.png)
5、点开终端
点击查看,选择终端就可以出来了
![](https://img-blog.csdnimg.cn/img_convert/d898d83fdc6227795319cf810029068c.png)
6、老是需要输入密码。现在设置免密登录
ssh-keygen -t rsa
#在服务器上执行上面命令,然后不停回车回车。
![](https://img-blog.csdnimg.cn/img_convert/e1b77b86ae7fcd29cdc9f071c3f7dedd.png)
mv id_rsa id_rsa_bak #做备份
cat id_rsa.pub >> authorized_keys
#将公钥的内容复制到authorized_keys
systemctl restart sshd
#重启sshd服务
完了
总结:这样子挺香的,在windows下面编辑和运行脚本。
附一张测试图
![](https://img-blog.csdnimg.cn/img_convert/76b3b214c008d4428a848435bd0cdf7d.png)
|