ssh: permission denied (publickey)

ubuntu服务器只给了公钥,需要修改ubuntu用户为root用户

sudo passwd root 
sudo vi /etc/ssh/sshd_config 
将PermitRootLogin这一项改为yes 
sudo service ssh restart

一波操作后结果
ssh: permission denied (publickey)

ssh出现permission denied (publickey)问题:
修改/etc/ssh/sshd-config文件.
将其中的PermitRootLogin no修改为yes
PubkeyAuthentication yes修改为no
AuthorizedKeysFile .ssh/authorized_keys前面加上#屏蔽掉,
PasswordAuthentication no修改为yes就可以了。

vi /etc/ssh/sshd-config (详细说说sshd-config的配置解释)
Subsystem       sftp    /usr/libexec/openssh/sftp-server
Port 22
Protocol 2
PermitRootLogin no
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
CACertificateFile  /etc/ssh/ca/ca.cert
PasswordAuthentication no
PermitEmptyPasswords no
PrintMotd no
ChallengeResponseAuthentication no
UseDNS no
ClientAliveInterval 60

OK

发布了203 篇原创文章 · 获赞 106 · 访问量 280万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章