SSH免密登录
服务器A实现免密登录服务器B。(基于Linux服务器)
实现过程
一、服务器A公钥的生成
服务器A上命令行界面输入下面命令,会在当前用户目录下新建[.ssh]文件夹,文件夹内包含id_rsa(私钥)与id_rsa.pub(公钥)
服务器A:~ nicholas.joey$ ssh-keygen -t rsa -C "你的邮箱"
服务器A:~ nicholas.joey$ cd .ssh
服务器A:.ssh nicholas.joey$ ls -al
total 40
drwx------ 6 nicholas.joey staff 192 2 3 14:13 .
drwxr-xr-x+ 47 nicholas.joey staff 1504 2 3 14:13 ..
-rw-r--r-- 1 nicholas.joey staff 263 2 3 14:13 config
-rw------- 1 nicholas.joey staff 2602 11 14 14:08 id_rsa
-rw-r--r-- 1 nicholas.joey staff 570 11 14 14:08 id_rsa.pub
-rw-r--r--@ 1 nicholas.joey staff 6270 2 3 09:14 known_hosts
二、目标服务器B的处理
当前用户目录下是否存在[.ssh]文件夹,没有则新建[.ssh]文件夹并赋予 700 权限。