我在 的帮助下生成了公钥和私钥ssh-keygen
。
现在我想添加public_key
到服务器,要添加public_key
到服务器,首先我想登录到服务器,但我无法登录到服务器并出现错误permission denied(publickey,password)
。
如何登录服务器以及如何将public_key
内容复制到服务器端authorized_key
文件中。
/etc/ssh/sshd_config
:
Port 22,
Protocol 2,
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
UsePrivilegeSeparation yes
KeyRegenerationInterval yes
ServerKeyBits 768
SyslogFacility AUTH
Loglevel INFO
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubketAuthentication yes
HostbasedAuthentication no
IgnoreRhosts yes
RhostsRSAAuthentication no
PasswordAuthentication yes
PermitEmptyPasswords no
ChallengeResponseAuthentication no
UsePAM yes
内容/var/log/auth.log
:
内容/etc/passwd
:
内容auth.log
:
尝试运行:ssh -vv [email protected]
内容/.ssh/config file
:
SSH 状态:
检查防火墙运行状态:
[ssh-复制-id]
答案1
您的debian
用户没有设置 shell。
通过以下方式设置 shell:
$ sudo chsh -s /bin/bash debian