使用证书登录Centos

PlanB Linux评论4,531阅读模式

1、新建链接

使用证书登录Centos

2. 点击Authentication, --Method选择Public Key,点击Browse

使用证书登录Centos

3、点击Generate生成public/private key

使用证书登录Centos

4、点击Next

使用证书登录Centos

5、自动生成Key,随后点击Next

使用证书登录Centos

6、设置Key的名称和保护密码,保护密码也可以不设。

使用证书登录Centos

7、保存公钥,点击Save as file

使用证书登录Centos

8、点击OK

使用证书登录Centos

9.可用WinSCP3,把刚才的保存的公钥上传到linux服务器的~/.ssh目录下,并改名为authorized_keys

mkdir ~/.ssh
mv bensonkey.pub authorized_keys

10、编辑sshd配置文件

vim /etc/ssh/sshd_config

将以下注释去掉:

PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

修改:PasswordAuthentication yes  为: PasswordAuthentication no

禁止使用密码登录

11、重启sshd服务

service sshd restart

12、使用Key+保护密码登录,这样要登录linux主机就只能凭用户名+Key+保护密码登录,禁用了用户名+密码方式登录,安全性大大提高。

使用证书登录Centos

扩展:如果除了windows登陆linux服务器用认证,linux客户端也用证书登陆该台服务器,则可以把linux的客户端公钥追加到authorized_keys。

weinxin
我的微信
我的微信
微信扫一扫
 
PlanB
  • 本文由 PlanB 发表于 2016年11月26日 01:00:02
  • 转载请务必保留本文链接:https://kper.net/329.html
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: