于吉吉的技术博客

建造高性能门户网

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  65 随笔 :: 6 文章 :: 149 评论 :: 0 Trackbacks
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







posted on 2011-01-04 14:10 陈于喆 阅读(71376) 评论(6)  编辑  收藏 所属分类: linux

评论

# re: [收藏]ssh: permission denied (publickey) 2014-01-03 21:24 你妈的害死人啊
PubkeyAuthentication yes修改为no后,重启SSH后登陆不到主机了。到机房又不方便。  回复  更多评论
  

# re: [收藏]ssh: permission denied (publickey) 2014-03-05 14:30 sss
真你妈的害死人啊。赶紧该博客吧。
  回复  更多评论
  

# re: [收藏]ssh: permission denied (publickey)[未登录] 2014-07-17 21:37 X
楼主就是传说中的 坑爹 的  回复  更多评论
  

# re: [收藏]ssh: permission denied (publickey) 2015-06-11 16:13 9898
文件名打错了  回复  更多评论
  

# re: [收藏]ssh: permission denied (publickey) 2015-07-14 14:04 逗比
卧槽,坑爹。按照上面的配置做的话,你绝逼要哭晕在厕所  回复  更多评论
  

# re: [收藏]ssh: permission denied (publickey) 2015-07-30 11:21 jasmine
@逗比
虽然文章有的地方写的不对, 但是不看完文章的行为跟你的id太配了.  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: