国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 服務器 > 管理維護 > 正文

通過秘鑰實現scp不輸入密碼傳送文件

2024-09-10 14:19:03
字體:
來源:轉載
供稿:網友

 

經常在不同linux機器之間互相scp拷文件,每次總是要輸入密碼才可行。

 
通過ssh-keygen生成公鑰,在兩臺機器之間互相建立信任通道即可。

 
假設本地機器client,遠程機器為server。

 
1. 生成rsa keygen

 
[winter@client winter] $ ssh-keygen -b 1024 -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/winter/.ssh/id_rsa): <Enter>
Enter passphrase (empty for no passphrase): <Enter>
Enter same passphrase again: <Enter>
Your identification has been saved in /home/winter/.ssh/id_rsa.
Your public key has been saved in /home/winter/.ssh/id_rsa.pub.
The key fingerprint is:
33:d4:7b:9c:87:04:cf:14:40:22:6d:c7:15:78:97:6a winter@client

 
直接上面公鑰和私鑰存放地址可以直接回車,私鑰密碼可以直接回車,也可以輸入。

 
2. 查看.ssh目錄下了多私鑰和公鑰文件

 
[winter@client winter] $ ls .ssh/
id_rsa  id_rsa.pub  known_hosts

 
3. 拷貝公鑰到目標機器上,并改名成authorized_keys

 
[winter@client winter] $ scp .ssh/id_rsa.pub winter@192.168.0.110:/home/winter/.ssh/authorized_keys
The authenticity of host '192.168.0.110(192.168.0.110)' can't be established.
RSA key fingerprint is 5b:78:e8:e9:dc:d8:db:bd:f7:66:44:e6:3b:ce:f2:79.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.110' (RSA) to the list of known hosts.
winter@192.168.0.110's password: <Enter>
id_rsa.pub                                                                     100%  221     1.2MB/s   00:00
首次scp命令時候還是會提示輸入密碼,還有是否繼續鏈接的提示,以后
4. 測試ssh進入
[winter@client winter] $ ssh 192.168.0.110
5. ok,搞定!
 
[winter@server winter] # it's ok!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 沁阳市| 奉新县| 河间市| 资源县| 永宁县| 南乐县| 晋中市| 定南县| 龙口市| 福贡县| 息烽县| 武安市| 潮安县| 南岸区| 荣成市| 海伦市| 临猗县| 香格里拉县| 塔河县| 临西县| 江川县| 星子县| 威信县| 农安县| 宾阳县| 祥云县| 托克逊县| 敖汉旗| 巨野县| 清新县| 会宁县| 朝阳县| 文化| 镇宁| 山阳县| 汝阳县| 澎湖县| 方城县| 公安县| 砚山县| 安阳县|