Putty 的 Server refused our key

我一直都是這樣教人家的,用 puttygen 可以產生 public/private key
將 public key 丟到 ~/.ssh/authorized_keys 內,記得前面要加上 “ssh-rsa “(不含”)

存檔時,Password Phase 不要設
然後 putty 內 Auto-Login Name 及 Connection->ssh->Auth 的 Private Key 設上
blah blah blah
就可以用 putty 不需要密碼,直接連上 ssh server
就算我不寫,網路也有一堆文章在講這個的

今天用 Fedora Core 2 踼到鐵板
putty 給我出現 “Server refused our key”
查了半天
原來是 authorized_keys 的權限, group 和 other 的 write 權限不能為 w
要不然就會一直出現這個訊息。
果然是有安全的概念:twisted:

  1. 岂止是文件,连.ssh这个目录也只能是这个权限:
    rwx–x–x
    也就是说只有这个目录的user能对该目录读写,别的用户都不行。

  2. ChallengeResponseAuthentication yes
    PasswordAuthentication yes

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>