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
Port 22 # SSH 預設使用 22 這個 port,您也可以使用多的 port !亦即重復使用 port 這個設定項目即可!
Protocol 2 # 選擇的 SSH 協議版本,可以是 1 也可以是 2 ,如果要同時支持兩者,就必須要使用 2,1 這個分隔了
PermitRootLogin no # 是否允許 root 登入!預設是允許的,但是建議設定成 no!
PubkeyAuthentication yes # 是否允許 Public Key
AuthorizedKeysFile .ssh/authorized_keys # 上面這個在設定若要使用不需要密碼登入的賬號時,那么那個賬號的存放檔案所在檔名!
PasswordAuthentication no # 是否需要密碼的驗證
PermitEmptyPasswords no # 若上面那一項如果設定為 yes 的話,這一項就最好設定為 no ,這個項目在是否允許以空的密碼登入!當然不許!
PrintMotd no # 登入后是否顯示出一些信息呢?例如上次登入的時間、地點等
ChallengeResponseAuthentication no # 是否啟用其它的 PAM 模塊!啟用這個模塊將會導致 PasswordAuthentication 設定失效!
UseDNS no
ClientAliveInterval 60