我按照这个教程来设置SSH。 现在它提示input密码,但是当我input任何内容并返回时,它会要求input密码,我可以使用它来login。 我怎样才能防止呢?
我的sshd_config如下:
Port 22 Protocol 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key UsePrivilegeSeparation yes KeyRegenerationInterval 3600 ServerKeyBits 768 SyslogFacility AUTH LogLevel VERBOSE LoginGraceTime 20 PermitRootLogin no StrictModes yes RSAAuthentication yes PubkeyAuthentication yes IgnoreRhosts yes RhostsRSAAuthentication no HostbasedAuthentication no PermitEmptyPasswords no ChallengeResponseAuthentication yes PasswordAuthentication no X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server UsePAM yes
您已经closures了PasswordAuthentication (即sshd的内置密码authentication),但是打开了ChallengeResponseAuthentication (即通过PAMauthentication,默认意味着密码authentication)。 如果您只需要基于密钥的身份validation,请closuresChallengeResponseAuthentication 。
你重新启动了ssh守护进程吗?
你有没有检查所有者和.ssh目录的权限?
其目录和里面的文件应该由loginID自己。 该目录应该具有权限700(只有login用户允许访问),文件应该是600。
这听起来像你给你的私钥分配了密码。 这是你的连接尝试提示你。 你需要删除它,所以私钥不再被encryption。 您可以在设置空密码的同时重新创build密钥(也可以将其input到allowed_hosts文件中)。 或者,使用ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]从当前密钥设置空密码
– 克里斯托弗·卡雷尔