Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
vscode remote 免密码登录
# 客户端,cmd运行改命令,密码设为空可直接按Enter回车
ssh-keygen -t rsa -b 4096
# Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
# Enter passphrase (empty for no passphrase):
# Enter same passphrase again:
# Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa
# Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub
# 服务器端配置公钥,拷贝客户端公钥 id_rsa.pub 内容写入服务器
vi ~/.ssh/authorized_keys
# 其它配置(以上配置完成已经可以了)
# 文件权限要求
chmod 600 authorized_keys
chmod 700 ~/.ssh
# 查看或配置打开密钥登录功能,默认不需要修改配置
vi /etc/ssh/sshd_config
# 禁用密码登录配置 PasswordAuthentication no
systemctl restart sshd # 配置后重启服务
# help
https://zhuanlan.zhihu.com/p/117292835
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment