ssh出現(xiàn)permission denied (publickey)問(wèn)題:
修改/etc/ssh/sshd-config文件.
將其中的PermitRootLogin no修改為yes
PubkeyAuthentication yes修改為no
AuthorizedKeysFile .ssh/authorized_keys前面加上#屏蔽掉,
PasswordAuthentication no修改為yes就可以了。
vi /etc/ssh/sshd-config (詳細(xì)說(shuō)說(shuō)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
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
Port 22 # SSH 預(yù)設(shè)使用 22 這個(gè) port,您也可以使用多的 port !亦即重復(fù)使用 port 這個(gè)設(shè)定項(xiàng)目即可!
Protocol 2 # 選擇的 SSH 協(xié)議版本,可以是 1 也可以是 2 ,如果要同時(shí)支持兩者,就必須要使用 2,1 這個(gè)分隔了
PermitRootLogin no # 是否允許 root 登入!預(yù)設(shè)是允許的,但是建議設(shè)定成 no!
PubkeyAuthentication yes # 是否允許 Public Key
AuthorizedKeysFile .ssh/authorized_keys # 上面這個(gè)在設(shè)定若要使用不需要密碼登入的賬號(hào)時(shí),那么那個(gè)賬號(hào)的存放檔案所在檔名!
PasswordAuthentication no # 是否需要密碼的驗(yàn)證
PermitEmptyPasswords no # 若上面那一項(xiàng)如果設(shè)定為 yes 的話,這一項(xiàng)就最好設(shè)定為 no ,這個(gè)項(xiàng)目在是否允許以空的密碼登入!當(dāng)然不許!
PrintMotd no # 登入后是否顯示出一些信息呢?例如上次登入的時(shí)間、地點(diǎn)等
ChallengeResponseAuthentication no # 是否啟用其它的 PAM 模塊!啟用這個(gè)模塊將會(huì)導(dǎo)致 PasswordAuthentication 設(shè)定失效!
UseDNS no
ClientAliveInterval 60