[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
最近在B站上看到Vscode可以远程连接Linux, 不仅有与linux一模一样的终端,而且写代码很舒服,所以尝试了一下远程连接。
首先,要先在Vscode中安装 “Remote-SSH”扩展(插件),
安装好之后,在工具栏会出现这个图标:
之后点击“+”,添加远程主机:
点击之后,会弹出一个框,要我们输入待连接的远程主机的用户名和IP地址:按格式输入,输入之后,回车键确认
如何查看Linux的IP地址:
方法一:进入Linux的设置(Setting)
方法二:在linux的终端输入一条指令
$ ifconfig
回车之后,点击config配置文件,
再点击Open config, 去配置config文件的内容
打开config文件之后,注意文件中是否已经写好User的信息(即linux的用户名),如果没写好,我门就自己写上去(注意大小写)
检查完之后,Ctrl + s保存,就可以关闭这个文件了
关闭之后,可以点击连接远程主机
连接过程:
如果连接成功,它会让我们输入密码,即linux的密码,输入之后就能正常连接了
只要到输入密码这一步,应该就算是连接成功了。
可能出现的问题:
一直连接失败:而且错误信息显示“管道写入失败”
可能的原因时;Linux的防火墙阻止我们远程连接,可以在linux中尝试一下这条指令:关闭防火墙
$ sudo ufw disable
关闭之后再去Vscode尝试连接Linux,就能成功了。