ssh登陆不再自己输密码 CentOS to Redhat
来源:百度文库 编辑:神马文学网 时间:2024/04/27 22:39:19
让centos45的root用户ssh登入redhat9 时不需要手动输入密码
在centos45下的设置:
[root@centos45 ~]# cd
[root@centos45 ~]# ssh-keygen -d 运行这个才会生成.ssh这个目录
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Created directory ‘/root/.ssh‘.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
1f:24:66:48:d2:4b:3c:ee:02:a8:49:d3:d5:76:8f:e4root@centos45
[root@centos45 ~]# cd .ssh
[root@centos45 .ssh]# ls
id_dsa id_dsa.pub [root@centos45 .ssh]# scp id_dsa.pub 10.10.7.247:/root/.ssh/centos45_authorized_keys2 其实应该用主机名redhat9,但我没在host中添加只好用IP代替
The authenticity of host ‘10.10.7.247 (10.10.7.247)‘ can‘t be established.
RSA key fingerprint is 20:10:bd:9a:5f:56:36:1c:25:6a:dc:c8:8b:33:15:9f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘10.10.7.247‘ (RSA) to the list of known hosts.
root@10.10.7.247‘s password:
Permission denied, please try again.
root@10.10.7.247‘s password:
id_dsa.pub 100% 603 0.6KB/s 00:00
在redhat9下的设置:
[root@redhat9 root]# cd
[root@redhat9 root]# mkdir .ssh [root@redhat9 root]# chmod 700 .ssh
[root@redhat9 root]# ll -a
total 80
drwxr-x--- 4 root root 4096 Jul 6 09:03 .
drwxr-xr-x 20 root root 4096 Jul 6 08:47 ..
-rw-r--r-- 1 root root 1126 Aug 24 1995 .Xresources
-rw------- 1 root root 3505 Jun 21 10:41 .bash_history
-rw-r--r-- 1 root root 24 Jun 11 2000 .bash_logout
-rw-r--r-- 1 root root 234 Jul 6 2001 .bash_profile
-rw-r--r-- 1 root root 176 Aug 24 1995 .bashrc
-rw-r--r-- 1 root root 210 Jun 11 2000 .cshrc
drwx------ 2 root root 4096 Jun 16 23:18 .gconfd
drwx------ 2 root root 4096 Jul 6 09:03 .ssh
-rw-r--r-- 1 root root 196 Jul 11 2000 .tcshrc
-rw------- 1 root root 4496 Jun 21 10:12 .viminfo
-rw-r--r-- 1 root root 1157 Jun 16 23:45 anaconda-ks.cfg
-rw-r--r-- 1 root root 14041 Jun 16 23:42 install.log
-rw-r--r-- 1 root root 3534 Jun 16 23:42 install.log.syslog
-rw-r--r-- 1 root root 1671 Jun 17 11:09 root.txt
[root@redhat9 root]# cd .ssh
[root@redhat9 .ssh]# ll
total 4
-rw-r--r-- 1 root root 603 Jul 6 09:14 centos45_authorized_keys 2
[root@redhat9 .ssh]# cat centos45_authorized_keys2 >> authorized_keys2
[root@redhat9 .ssh]# ll
total 8
-rw-r--r-- 1 root root 603 Jul 6 09:15 authorized_keys2
-rw-r--r-- 1 root root 603 Jul 6 09:14 centos45_authorized_keys2
测试结果:
[root@centos45 .ssh]# ssh 10.10.7.247
Last login: Fri Jul 6 08:50:59 2007 from 10.10.7.245
[root@redhat9 root]# ls
anaconda-ks.cfg install.log install.log.syslog root.txt
[root@redhat9 root]# exit
logout
Connection to 10.10.7.247 closed.
参考资料:
http://www.ichiayi.com/wiki/tech/sshlogin
http://www.l-penguin.idv.tw/article/ssh-keygen.htm
在centos45下的设置:
[root@centos45 ~]# cd
[root@centos45 ~]# ssh-keygen -d 运行这个才会生成.ssh这个目录
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Created directory ‘/root/.ssh‘.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
1f:24:66:48:d2:4b:3c:ee:02:a8:49:d3:d5:76:8f:e4root@centos45
[root@centos45 ~]# cd .ssh
[root@centos45 .ssh]# ls
id_dsa id_dsa.pub [root@centos45 .ssh]# scp id_dsa.pub 10.10.7.247:/root/.ssh/centos45_authorized_keys2 其实应该用主机名redhat9,但我没在host中添加只好用IP代替
The authenticity of host ‘10.10.7.247 (10.10.7.247)‘ can‘t be established.
RSA key fingerprint is 20:10:bd:9a:5f:56:36:1c:25:6a:dc:c8:8b:33:15:9f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘10.10.7.247‘ (RSA) to the list of known hosts.
root@10.10.7.247‘s password:
Permission denied, please try again.
root@10.10.7.247‘s password:
id_dsa.pub 100% 603 0.6KB/s 00:00
在redhat9下的设置:
[root@redhat9 root]# cd
[root@redhat9 root]# mkdir .ssh [root@redhat9 root]# chmod 700 .ssh
[root@redhat9 root]# ll -a
total 80
drwxr-x--- 4 root root 4096 Jul 6 09:03 .
drwxr-xr-x 20 root root 4096 Jul 6 08:47 ..
-rw-r--r-- 1 root root 1126 Aug 24 1995 .Xresources
-rw------- 1 root root 3505 Jun 21 10:41 .bash_history
-rw-r--r-- 1 root root 24 Jun 11 2000 .bash_logout
-rw-r--r-- 1 root root 234 Jul 6 2001 .bash_profile
-rw-r--r-- 1 root root 176 Aug 24 1995 .bashrc
-rw-r--r-- 1 root root 210 Jun 11 2000 .cshrc
drwx------ 2 root root 4096 Jun 16 23:18 .gconfd
drwx------ 2 root root 4096 Jul 6 09:03 .ssh
-rw-r--r-- 1 root root 196 Jul 11 2000 .tcshrc
-rw------- 1 root root 4496 Jun 21 10:12 .viminfo
-rw-r--r-- 1 root root 1157 Jun 16 23:45 anaconda-ks.cfg
-rw-r--r-- 1 root root 14041 Jun 16 23:42 install.log
-rw-r--r-- 1 root root 3534 Jun 16 23:42 install.log.syslog
-rw-r--r-- 1 root root 1671 Jun 17 11:09 root.txt
[root@redhat9 root]# cd .ssh
[root@redhat9 .ssh]# ll
total 4
-rw-r--r-- 1 root root 603 Jul 6 09:14 centos45_authorized_keys 2
[root@redhat9 .ssh]# cat centos45_authorized_keys2 >> authorized_keys2
[root@redhat9 .ssh]# ll
total 8
-rw-r--r-- 1 root root 603 Jul 6 09:15 authorized_keys2
-rw-r--r-- 1 root root 603 Jul 6 09:14 centos45_authorized_keys2
测试结果:
[root@centos45 .ssh]# ssh 10.10.7.247
Last login: Fri Jul 6 08:50:59 2007 from 10.10.7.245
[root@redhat9 root]# ls
anaconda-ks.cfg install.log install.log.syslog root.txt
[root@redhat9 root]# exit
logout
Connection to 10.10.7.247 closed.
参考资料:
http://www.ichiayi.com/wiki/tech/sshlogin
http://www.l-penguin.idv.tw/article/ssh-keygen.htm
ssh登陆不再自己输密码 CentOS to Redhat
ssh无密码访问
SSH设置-----允许个别用户登陆SSH - Linux学习网
配置Redhat Enterprise Linux 5.3使用CentOS的更新源
redhat中ROOT密码修改
使ssh不用输入密码
技巧:SSH登陆后显示中文乱码的解决办法
ssh
绕过帐户密码登陆XP
绕过帐户密码登陆XP
How To Open Port 80 on Iptables on Centos | H...
How to enable the FTP / SSH /Telnet for ESXi
忘记密码不再怕
设有密码的电脑该如何登陆
如何登陆设有密码的电脑该
linux下的SSH登陆工具SecureCRT使用 - linux爱好者 - CSDN博客
linux下连接window xp共享HP打印机 - Redhat/Fedora/CentOS - 红联Linux论坛 全球Linux人网上交流平台 - 天下没有难学的Linux
redhat as 4 root密码遗忘的解决方法 - LUPA 开源博客
RHCE_LAB(2)SSH远程登录自动验证(不输入用户登录密码)的实现
如何修改weblogic console登陆的用户名和密码
CentOS简介
Redhat security
什么是SSH?
善待自己 我们不再年轻