centos 设置ssh 私钥访问
来源:互联网 发布:淘宝卖家手机上改价 编辑:程序博客网 时间:2024/06/06 20:44
CentOS Linux和与之对应版本号的RHEL发行版具有软件包级别的二进制兼容性,即某个RPM软件包如果可以安装运行在RHEL产品中,就可以正常地安装运行在对应版本的CentOS Linux中。CentOS Linux创建安全的私钥文件。
1、CentOS Linux创建进入sshd_config(/etc/ssh/sshd_config)#ServerKeyBits 768ServerKeyBits 1024 修改加密强度为1024bit#PasswordAuthentication yes
PasswordAuthenticatino no 不允许密码方式登陆#PermitEmptyPasswords onPermitEmptyPasswords no 禁止空密码登陆
2、CentOS Linux创建修改hosts.deny(/etc/hosts.deny)文件,禁止所有的SSH连接。在hosts.deny文件末尾加上sshd:ALL
3、CentOS Linux创建修改hosts.allow(/etc/hosts.allow)文件,加上允许进行SSH连接的IP地址或IP地址段。在hosts.allow文件末尾加上sshd:IP地址或IP地址段
4、CentOS Linux创建重启SSH服务service sshd restart
5、CentOS Linux创建公钥与私钥文件[root@CentOS~]ssh-keygen -t rsa 创建公钥与私钥Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): ← 钥匙的文件名,这里保持默认直接回车Created directory '/root/.ssh'Enter passphrase (empty for no passphrase): ← 输入口令Enter same passphrase again: ← 再次输入口令Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_rsa.pub.The key fingerprint is:
tf:rs:e3:7s:28:59:5s:93:fe:33:84:01:cj:65:3b:8e root@CentOS~[root@CentOS ~]# cd ~/.ssh ← 进入用户SSH配置文件的目录[root@CentOS ~]# ls -l ← 列出文件total 16 -rw------- 1 root root 951 Sep 4 19:22 id_rsa ← 确认私钥已被建立-rw-r--r-- 1 root root 241 Sep 4 19:22 id_rsa.pub ← 确认公钥已被建立
[root@CentOS ~]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys ← 公钥内容输出到相应文件中
[root@CentOS ~]# rm -f ~/.ssh/id_rsa.pub ← 删除原来的公钥文件
[root@CentOS ~]# chmod 400 ~/.ssh/authorized_keys ← 将新建立的公钥文件属性设置为400
6、CentOS Linux导出id_rsa文件
7、使用PuTTY工具组里的PuTTYGen来转换私钥,打开PuTTYGen,选择“载入”,选择刚才的“id_rsa”文件(选择文件的时候,文件类型改为“所有文件(*.*)”),输入刚才创建公钥与私钥时候的密码,便可以转缼成功,并选择“保存私钥”。
8、在用PuTTY登陆Linux系统的时候,在下面的“SSH”-“认证”里,在“认证私钥文件处”选择刚才转换的私钥文件即可进行登陆。以上介绍CentOS Linux系统创建。
1、CentOS Linux创建进入sshd_config(/etc/ssh/sshd_config)#ServerKeyBits 768ServerKeyBits 1024 修改加密强度为1024bit#PasswordAuthentication yes
PasswordAuthenticatino no 不允许密码方式登陆#PermitEmptyPasswords onPermitEmptyPasswords no 禁止空密码登陆
2、CentOS Linux创建修改hosts.deny(/etc/hosts.deny)文件,禁止所有的SSH连接。在hosts.deny文件末尾加上sshd:ALL
3、CentOS Linux创建修改hosts.allow(/etc/hosts.allow)文件,加上允许进行SSH连接的IP地址或IP地址段。在hosts.allow文件末尾加上sshd:IP地址或IP地址段
4、CentOS Linux创建重启SSH服务service sshd restart
5、CentOS Linux创建公钥与私钥文件[root@CentOS~]ssh-keygen -t rsa 创建公钥与私钥Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): ← 钥匙的文件名,这里保持默认直接回车Created directory '/root/.ssh'Enter passphrase (empty for no passphrase): ← 输入口令Enter same passphrase again: ← 再次输入口令Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_rsa.pub.The key fingerprint is:
tf:rs:e3:7s:28:59:5s:93:fe:33:84:01:cj:65:3b:8e root@CentOS~[root@CentOS ~]# cd ~/.ssh ← 进入用户SSH配置文件的目录[root@CentOS ~]# ls -l ← 列出文件total 16 -rw------- 1 root root 951 Sep 4 19:22 id_rsa ← 确认私钥已被建立-rw-r--r-- 1 root root 241 Sep 4 19:22 id_rsa.pub ← 确认公钥已被建立
[root@CentOS ~]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys ← 公钥内容输出到相应文件中
[root@CentOS ~]# rm -f ~/.ssh/id_rsa.pub ← 删除原来的公钥文件
[root@CentOS ~]# chmod 400 ~/.ssh/authorized_keys ← 将新建立的公钥文件属性设置为400
6、CentOS Linux导出id_rsa文件
7、使用PuTTY工具组里的PuTTYGen来转换私钥,打开PuTTYGen,选择“载入”,选择刚才的“id_rsa”文件(选择文件的时候,文件类型改为“所有文件(*.*)”),输入刚才创建公钥与私钥时候的密码,便可以转缼成功,并选择“保存私钥”。
8、在用PuTTY登陆Linux系统的时候,在下面的“SSH”-“认证”里,在“认证私钥文件处”选择刚才转换的私钥文件即可进行登陆。以上介绍CentOS Linux系统创建。
0 0
- centos 设置ssh 私钥访问
- centos 设置ssh 私钥访问
- CentOS 7.2设置SSH公钥登录
- centos 7ssh设置
- CentOS设置SSH Key登录
- CentOS SSH远程登录设置
- CentOS设置SSH Key登录
- ssh使用私钥访问
- CentOS中如何配置SSH安全访问
- centos配置ssh无密码访问
- CentOS设置网络访问代理
- Centos 设置Mysql远程访问
- centos下设置ssh连接时间
- CentOS, 快速设置ssh无密码登录
- Linux/Centos服务器ssh安全设置
- 设置centos下SSH无密码登陆
- centos下设置ssh连接时间
- centos设置ssh命令无密码登录
- 西安邀请赛
- Android 下拉刷新上拉加载效果功能
- HBase Scan类用法
- inittab
- (原谅我这忘性超强的大脑吧)OE中admin的内置帐号
- centos 设置ssh 私钥访问
- 面试题之银行业务调度系统
- C# 获取操作系统类型
- 就是这么“高大上”!20个最受欢迎的Linux命令
- jvm性能相关信息的一些命令
- arm-linux常用
- I am here
- Qt之QTcpServer/QTcpSocket简单收发信息
- TOJ 1671 Steady Cow Assignment -- 多重二分图匹配 + 二分查找