CentOS SSH 无密码登陆
关键字:CentOS SSH,SSH无密码登陆,SSH
一、环境配置
1、服务端:CentOS release 5.3 IP:222.73.115.198
2、客服端:CentOS release 5.8 IP:192.168.4.244
二、配置SSH无密码登录需要3步:
1、生成公钥和私钥
2、导入公钥到认证文件,更改权限
3、测试
三、客户端配置
1、在客户端生成私钥与公钥;
# ssh-keygen
[root@jw02 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): #回车(代表无需密码登陆)
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:
04:45:0b:47:10:92:0c:b2:b9:d7:11:5b:49:05:e4:d9 root@jw02
[root@jw02 ~]# ls ~/.ssh/
id_rsa id_rsa.pub known_hosts
2、默认在 ~/.ssh或者/root/.ssh/目录生成两个文件:
公钥为:id_rsa.pub
私钥为:id_rsa