centos下配置ssh使用密钥
2024-10-19 21:22:29
查询了网上的一些教程,然后根据自己的实际操作,记录自己实际配置ssh密钥的过程:
首先在centos终端切换到要链接的用户,比如用户ssh
使用该用户生成密钥:
ssh-keygen -t rsa
中间需要输入密钥的口令
默认会在/home/ssh/.ssh 下面生成id_rsa 和 id_rsa.pub 两个文件
将id_rsa.pub重名命为: authorized_keys
mv id_rsa.pub authorized_keys
然后将id_rsa文件剪切到需要使用putty登陆的机器上
配置sshd的配置文件,开启密钥验证
gedit /etc/ssh/sshd_config
然后去掉如下三行代码前的注释:
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
UsePAM no
然后去掉密码验证
#PermitEmptyPasswords no
PasswordAuthentication no
保存重启sshd服务
service sshd restart
然后使用puttygen.exe将id_rsa转化为ppk文件
然后使用putty链接即可
我第一次链接也是遇到了错误,按照网上说的更改现需要密码验证,然后关闭,没有生效
最后重新使用puttygen.exe重新转化ppk文件,然后就可以了!
最新文章
- Chrome浏览器设置默认编码
- button按钮波纹,箭头特效css
- 1.GoldenGate 简单的一对一配置
- &;与&;&;,|与||
- VM~Linux联不上网
- [MetaHook] Load large texture from model
- 转载 javascript中的正则表达式总结 二
- sql 随笔 2015-08-07
- Visual Studio 扩展包(.vsix)制作
- java基础(十九)IO流(二)
- 柯里化(Curing)
- 转:使用Android API最佳实践
- 乐在其中设计模式(C#) - 策略模式(Strategy Pattern)
- gcc 编译
- 运用经典方法进行横截面数据分类 笔记 (基于R)
- APP网站安全漏洞检测服务的详细介绍
- 关于php,python,javascript文件或者模块导入引入的区别和联系
- Pandas基本功能之reindex重新索引
- springboot 学习之路 15(集成shiro)
- django rest framwork教程之 viewsets和routers