Mac ssh 连接报错 Permission denied (publickey)

时间:2023-03-09 07:31:12
Mac ssh 连接报错 Permission denied (publickey)

用的阿里云服务器,如果直接连接,会报下面错误:

$ ssh root@47.94.132.115
Permission denied (publickey).

创建服务器的时候,连接秘钥会生成并下载到本地(xishuai-key.pem),解决方式:

$ chmod  600 /users/xishuai/.ssh/xishuai-key.pem
$ ssh -i /users/xishuai/.ssh/xishuai-key.pem root@47.94.132.115