ssh root@192.168.124.128

密钥登录:
1)、ssh-keygen 生成公钥和私钥
[root@rhel5 ~]# ssh-keygen -t rsa
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:
4c:f2:c4:14:67:15:ef:5e:1e:43:44:94:45:ae:1a:cf root@rhel5

第二次生成
[root@rhel5 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
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:
9b:10:05:52:3e:67:a9:30:cd:84:28:36:85:c1:d6:0f root@rhel5

2)、把客户端公钥(id_rsa.pub)传给服务器:
[root@rhel5 .ssh]# ssh-copy-id -i id_rsa.pub 192.168.124.129
10
root@192.168.124.129's password:
Permission denied, please try again.
root@192.168.124.129's password:
Now try logging into the machine, with "ssh '192.168.124.129'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

公钥在服务器上的位置
[root@localhost .ssh]# ll
total 8
-rw------- 1 root root 392 Jun 20 23:47 authorized_keys //公钥被改名为authorized_keys,以后服务器就用它加密传输数据给客户端,客户端使用私钥--钥匙来做验证 能解开 ---->验证通过 解不开 ---->不是合法用户
-rw-r--r-- 1 root root 794 Jun 20 22:43 known_hosts

3)、无密码登录、无密码数据传输:
[root@rhel5 .ssh]#
[root@rhel5 .ssh]# ssh root@192.168.124.129
Last login: Wed Jun 20 22:44:09 2012 from 192.168.124.129
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#

实现无密码往回拽数据:
[root@rhel5 ~]# rm -rf log.tar.gz
[root@rhel5 ~]# rsync root@192.168.124.129:/tmp/log.tar.gz ./
[root@rhel5 ~]# ll
total 96
-rw------- 1 root root 1427 Jun 18 09:53 anaconda-ks.cfg
-rw-r--r-- 1 root root 26586 Jun 18 09:52 install.log
-rw-r--r-- 1 root root 3671 Jun 18 09:50 install.log.syslog
-rw-r--r-- 1 root root 9188 Jun 21 14:40 log.tar.gz
-rw-r--r-- 1 root root 26586 Jun 21 13:47 root@192.168.124.129
------------------------------------------------------------------

[root@rhel5 ~]# rm -rf log.tar.gz
[root@rhel5 ~]# scp root@192.168.124.129:/tmp/log.tar.gz ./
log.tar.gz 100% 9188 9.0KB/s 00:00
[root@rhel5 ~]# ll
total 96
-rw------- 1 root root 1427 Jun 18 09:53 anaconda-ks.cfg
-rw-r--r-- 1 root root 26586 Jun 18 09:52 install.log
-rw-r--r-- 1 root root 3671 Jun 18 09:50 install.log.syslog
-rw-r--r-- 1 root root 9188 Jun 21 14:38 log.tar.gz
-rw-r--r-- 1 root root 26586 Jun 21 13:47 root@192.168.124.129

口令登录:输入密码登录

远程传输是建立在远程登录之后的,登录一次---建立连接之后 开始传输数据
网上银行下载的证书:就是公钥---锁

最新文章

  1. PHP通过加锁实现并发情况下抢码实现
  2. 程序设计入门——C语言 第6周编程练习 2 完数(5分)
  3. Mysql数据库设置定时任务
  4. Oracle数据库的备份方法
  5. 详细介绍dll文件是什么
  6. ##6.2 Neutron计算节点-- openstack pike
  7. CentOS7上安装并配置Nginx、PHP、MySql
  8. CSS的浮动和定位
  9. Week_10 C
  10. wrk 性能测试工具安装与使用
  11. Express全系列教程之(一):Express的安装 和第一个程序
  12. MySQL 5.6 GTID Replication
  13. 数据库操作之整合Mybaties和事务讲解 5节课
  14. react native中使用 react-native-easy-toast 和react-native-htmlview
  15. Hibernate 再接触 组件映射
  16. Android组件之Service浅谈
  17. http之响应报文response
  18. delphi向SQL Server2005中存取图片
  19. linux编程之GDB调试
  20. VCF和GVCF格式说明

热门文章

  1. Snort里如何将一个tcpdump格式的二进制文件读取打印到屏幕上(图文详解)
  2. 【Mybatis】环境搭建
  3. Spring------IOC&DI
  4. struts2 <allowed-methods > 标签配置
  5. SQL Server调试存储过程
  6. 字符串(String)几个常用方法的详解
  7. 强大的云存储与应用管理工具DzzOffice1.0 Beta(大桌子办公)发布下载
  8. git的使用 及一些常见的错误处理
  9. opencv实现人脸,人眼,微笑检测
  10. chfn - 改变你的finger讯息