M1 macOS终端SSH连接报错:sign_and_send_pubkey: no mutual signature supported
解决M1 macOS终端SSH连接"no mutual signature supported"错误
问题场景
在M1 macOS终端执行以下命令连接SSH服务器:
ssh -i {myKeyFilePath/myKeyFile.pem} user@host
返回错误:
sign_and_send_pubkey: no mutual signature supported user@host: Permission denied (publickey).
已知条件:密钥文件权限为400,未修改SSH全局设置,IntelliJ可正常连接该远程主机。
解决方案
1. 临时指定签名算法连接
直接在SSH命令中追加签名算法参数,强制兼容服务器支持的算法:
ssh -o PubkeyAcceptedAlgorithms=+ssh-rsa -i {myKeyFilePath/myKeyFile.pem} user@host
2. 配置永久生效的SSH规则
编辑本地~/.ssh/config文件(若不存在则新建),添加对应主机的专属配置,避免每次输入额外参数:
Host 你的主机地址 User 你的用户名 IdentityFile 你的密钥文件路径/myKeyFile.pem PubkeyAcceptedAlgorithms +ssh-rsa
保存文件后,直接执行ssh 你的主机地址即可连接。
3. 验证公钥一致性
提取本地密钥对应的公钥,对比服务器~/.ssh/authorized_keys中的条目,确保两者完全一致:
ssh-keygen -y -f {myKeyFilePath/myKeyFile.pem}
将输出的公钥字符串,和服务器上authorized_keys里的对应行做比对,若不一致则重新上传公钥。
内容的提问来源于stack exchange,提问作者박진근
相关产品推荐
相关产品推荐

