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