要求输入密码时没有密码输入密码、密码

2023-09-11 09:41:06 作者:孤妄友人.

我有一台机器在AWS EC2平台。它是一种Linux平台,与没有密码的名为root用户,

I have a machine in AWS EC2 platform. Its a linux platform, with the user named root having no password,

现在我必须设置,SSH密钥验证这台机器上,为此首先,我安装了Cygwin,那么我也跟着下面的步骤:

Now I have to setup, ssh key authentication on this machine, For that firstly, I installed cygwin, then I followed the following steps :

 1. ssh-keygen -t dsa -f ~/.ssh/<key name> -C "root@<ip>"
 2. cat ~/.ssh/<key name>.pub | ssh  root@<ip> "cat >> ~/.ssh/authorized_keys"

现在,当我这样做,它要求密码,但用户从来没有设置任何密码的根

Now, when I do this, it asks for password, but I never setup any password on the user root.

另外,如果我不提供密码,它说,访问被拒绝!

Also if I does not supply password, it says access denied!!!

问题出在哪里?

推荐答案

检查的权限在的〜/ .ssh / authorized_keys中他们需要的是 600 ,并在的〜/ .ssh 目录中,他们需要的是 700

Check the permissions on your ~/.ssh/authorized_keys they need to be 600 and also on the ~/.ssh directory, they need to be 700.

你也可以运行你的腰带客户端与 -vvv 选项以获取调试信息。

Also you can run your sash client with the -vvv option to get debug information.