配置Windows到linux的ssl免密传输数据包
第一步 在Windows上生成SSL“公钥-私钥“文件对
ssh-keygen
连续enter,在路径中会生成C:\Users\admin(用户)\.ssh
公私钥文件
——id_rsa 私钥
——id_rsa.pub 公钥
——known_hosts 可不用管
修改id_rsa.pub文件,删除最后的字符串"username@xxx-pc"
第二步 将公钥拷贝到服务器端
手动拷贝id_rsa.pub到/root/.ssh。也可用scp
scp id_rsa.pub root@remotehost:/root/.ssh/
第三步 在服务器端配置公钥
cd /root/.ssh
touch authorized_keys #创建公钥keys文件
cat id_rsa.pub >> authorized_keys #将公钥字符串追加拷贝到改文件
chmod 600 authorized_keys #修改文件权限
cd ..
chmod 700 .ssh #修改文件夹权限
第四步 配置shhd
vim /etc/ssh/sshd_config
对sshd_config文件做如下修改
RSAAuthentication yes
PubkeyAuthentication yes
PermitRootLogin yes # 如果用的市root用户,需要开启root远程登录
重启ssh
systemctl restart sshd