linux常用命令-linux sftp 公私钥生成

输入以下命令,连续回车三次

ssh-keygen -t rsa -b 1024
[weblogic@iZzm07uu28d7wcuv8t6ms3Z .ssh]$ ssh-keygen -t rsa -b 1024
Generating public/private rsa key pair.
Enter file in which to save the key (/home/weblogic/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/weblogic/.ssh/id_rsa.
Your public key has been saved in /home/weblogic/.ssh/id_rsa.pub.
The key fingerprint is:
d4:ad:bd:8e:ff:62:e9:c9:60:68:7b:38:ff:d9:17:ac weblogic@iZzm07uu28d7wcuv8t6ms3Z
The key's randomart image is:
+--[ RSA 1024]----+
|                 |
|         . .     |
|        . . .    |
|       .   o     |
|        S . . .  |
|         .   . o |
|        o.o ... .|
|       .oo.=+E  .|
|        .+o=Ooo. |
+-----------------+
[weblogic@iZzm07uu28d7wcuv8t6ms3Z .ssh]$ ls -la
total 20
drwx------ 2 weblogic weblogic 4096 Aug 14 15:18 .
drwx------ 7 weblogic weblogic 4096 Aug 14 15:08 ..
-rw------- 1 weblogic weblogic  887 Aug 14 15:18 id_rsa
-rw-r--r-- 1 weblogic weblogic  242 Aug 14 15:18 id_rsa.pub
-rw-r--r-- 1 weblogic weblogic 1226 Jul 23 22:18 known_hosts

在$HOME/.ssh 目录下面吗会生成三个文件 id_rsa(私钥) id_rsa.pub 公钥
其中known_hosts 为空文件刚开始生成的时候.
known_hosts主要作用为:记录链接到对方时,对方给的host key,每次连线都会检查目前对方给的host key 与你记录的host key是否相同,进行简单的验证。

你可能感兴趣的:(linux,sftp)