1.VSCode安装必要插件

        

2.编辑settings.json

vscode的设置中搜索settings.json

添加"remote.SSH.showLoginTerminal": true

{
    "remote.SSH.showLoginTerminal": true,
​
    "[json]": {
​
        "editor.quickSuggestions": {
            "strings": true
        },
        "editor.suggest.insertMode": "replace"
    }
}

3.在ubuntu上开启SSH服务

安装:sudo apt-get install openssh-server

启动SSH服务:sudo service ssh start

4.更改SSH服务配置:

sudo vi /etc/ssh/sshd_config

把配置文件中的PermitRootLogin without-password注释掉 增加一句PermitRootLogin yes

 5.插入公钥:

ssh-keygen -t rsa -C "youremail@example.com"  //输入你的邮箱地址

cd ~/.ssh

cat id_rsa.pub >> authorized_keys

6.重启SSH服务

/etc/init.d/ssh restart

7.查看ip:ifconfig

8.配置VSCode

 

 

Host--->linux的IP地址

HostName--->:linuxI的P地址

User--->linux下的用户名

点击阅读全文
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐