Macbook vscode 配置 ssh login
生效rsa
ssh-keygen -t rsa -C "test@qq.com"
ssh-copy-id -p 22 root@192.168.100.123
ssh -vt -p 22 root@192.168.100.123
rsa 报错
no mutual signature algorithm
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/.ssh/id_rsa RSA SHA256:JXYM7d2PIZ28hhg8M+EcnlepWsJMffxAg9Gu//imFm8
debug1: send_pubkey_test: no mutual signature algorithm
debug1: Trying private key: /Users/.ssh/id_ecdsa
debug1: Trying private key: /Users/.ssh/id_ecdsa_sk
debug1: Trying private key: /Users/.ssh/id_ed25519
debug1: Trying private key: /Users/.ssh/id_ed25519_sk
debug1: Trying private key: /Users/.ssh/id_xmss
debug1: Trying private key: /Users/.ssh/id_dsa
debug1: Next authentication method: password
root@192.168.100.123's password:
解决说明
就是openssh默认不再支持ssh-rsa算法啦,说是该算法存在安全隐患
rsa-Ed25519 配置
做法是使用Ed25519, 前面的rsa 可以不必清空
# 生成
ssh-keygen -t ed25519 -C "test@qq.com"
# 复制
ssh-copy-id -p 22 root@192.168.100.123
# 检查是否能登录
ssh -vt -p 22 root@192.168.100.123
abac@QQ-MB3 .ssh % ssh -t -p 22 root@192.168.100.123
Last login: Fri Nov 25 14:24:39 2022 from 192.168.100.123
ssh -config 配置
#vi ~/.ssh/config
Host 192.168.100.123
HostName 192.168.100.123
User root
Port 22
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_ed25519
Protocol 2
ServerAliveInterval 60
远程服务器重装后,macbook 之前的配置可以不变
做法是使用Ed25519, 前面的rsa 可以不必清空
# 清空远程机器192.168.100.123的所有信息,
vi ~/.ssh/know_host
# config 清空远程机器192.168.100.123的所有信息, 或将192.168.100.123 改成其他IP , 如不改ssh-copy-id 有会干扰,无法验证输入密码
vi ~/.ssh/config
# 复制xxxx.pub 到目标机器
ssh-copy-id -p 22 -i xxxx.pub root@192.168.100.123
# 检查是否能登录
ssh -vt -p 22 root@192.168.100.123