ssh 证书登录

客户端

ssh-keygen -t rsa #生成证书
ssh -i /demo/.ssh/id_rsa demo@<ssh_server_ip> #指定私钥文件登录
vi /etc/ssh/ssh_config
IdentityFile ~/.ssh/id_rsa #设置私钥路径

服务器

apt-get install openssh-server
mkdir
-p ~/.ssh/ cat id_rsa.pub >> ~/.ssh/authorized_keys #先上传公钥id_rsa.pub 再追加到authorized_keys vi /etc/ssh/sshd_config StrictModes no
PermitRootLogin yes RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .
ssh/authorized_keys #指定authorized_keys文件 PasswordAuthentication no 是否禁用密码登录 /etc/init.d/sshd restart

 

posted @ 2017-02-23 11:33  fr5s  阅读(169)  评论(0编辑  收藏  举报