Auth ssh with keys


每次配都要找一堆网页,最后郁闷了,所以在这记上一笔。环境是两台新装的机器,ssh客户端和服务器都安装上了,配置用的默认的。分为两台机器,C表示客户端,即发起ssh连接请求的机器,S自然是服务端了…

  1. S: mkdir ~/.ssh # create the directory for keys
  2. S: chmod 700 ~/.ssh # 必需滴,要不然不起作用
  3. C: ssh-keygen –d # generate dsa key, the type is changable
  4. C: cat ~/.ssh/id_dsa.pub | ssh user@host “cat – >>.ssh/authorized_keys” # copy the keys to remote host
  5. S: chmod 600 ~/.ssh/authorized_keys # 必需滴

这样好像就差不多了。多说一句,如果那个权限不对的话,会在log里面看到Authentication refused: bad ownership or modes云云(log文件在/var/log/secure),当然就连不上了~

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Live
  • Technorati

  1. No comments yet.
(will not be published)