ssh-keygen -t rsa -b 2048 -C "email@example.com"将公钥内容复制到服务器的authorized_keys中
# 本地机器 cat ~/.ssh/id_rsa.pub # 连接到服务器 # ssh xxx@xx.xx.xx.xx # 服务器 vim ~/.ssh/authorized_keys # 将上面cat出来的内容,添加到authorized_keys中的新的一行编辑VScode remote-ssh的本地配置
- Host可以是自定义的名字,缺省为ip
- Hostname为ip
- User为想登录服务器的用户
- Port 22 (默认为22,有需要可以改成其他端口)
- IdentityFile ~/.ssh/id_rsa (这是Unix写法,windows写法看下面的这个配置)
Host huaweiyun HostName xxx.x.xx8.37 User wolxxx IdentityFile "C:/Users/shanl/.ssh/id_rsa"



