1.windows10端:
在命令窗口运行
ssh-keygen -t rsa -b 4096
vscode安装Remote - SSH扩展,按Ctrl、Shift、P快捷键进入搜索,输入ssh,选择add new SSH host。
2.Ubuntu1804端:
1).安装openssh-server:
sudo apt install openssh-server
2).配置ssh
cd /etc/ssh sudo vim ssh_config 开启下面的两项: PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
3).将windows生成的公钥内容复制到~/.ssh/authorized_keys中。
cat id_rsa.pub >> authorized_keys
4).启动ssh服务
sudo service ssh start
5).查看Ubuntu的ip,将它设为静态ip。