VSCode使用SSH连接到Ubuntu 18.04虚拟机
-
VSCode安装必要插件
-
编辑settings.json
添加"remote.SSH.showLoginTerminal": true
-
虚拟机打开SSH服务
安装:sudo apt-get install openssh-server
启动SSH服务:sudo service ssh start
-
更改SSH服务配置:
/etc/ssh/sshd_config
把配置文件中的PermitRootLogin without-password
注释掉
增加一句PermitRootLogin yes
确定存在:PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
-
插入公钥:
~.ssh
cat id_rsa.pub >> authorized_keys
-
重启SSH服务
/etc/init.d/ssh restart
-
查看ip:
ipconfig
-
配置VSCode
参考资料:
https://blog.****.net/jiejiemcu/article/details/98752848
https://www.cnblogs.com/nightwindnw/p/11097178.html