目录
4.生成公钥root@chenxueqi:~# ssh-keygen -t rsa -b 4096编辑##出现这个 公钥生成成功
1.创建root密码,系统自带root用户
chenxueqi@chenxueqi:~$ sudo passwd root
2.输入密码
chenxueqi@chenxueqi:~$ su root
Password: ##输入密码
3.切换到家目录
root@chenxueqi:/home/chenxueqi# cd
4.生成公钥
root@chenxueqi:~# ssh-keygen -t rsa -b 4096
##出现这个 公钥生成成功
5.做免密
root@chenxueqi:~# ssh-copy-id root@192.168.1.132
下方报错
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.1.132 (192.168.1.132)' can't be established.
ECDSA key fingerprint is SHA256:RZjWNBD8kILvrvMRh29EKG0JfZcktkHks4oTJMq21rA.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.1.132's password:
Permission denied, please try again.
root@192.168.1.132's password:
Permission denied, please try again.
root@192.168.1.132's password:
6.修改上方报错
远程连接192.168.1.132服务器
6.1修改密码
chenxueqi@waware:~$ passwd root
6.2修改ssh配置文件
root@waware:~# vim /etc/ssh/sshd_config
6.2.1匹配到下图
6.2.2 去掉注释
6.3.1匹配到下图
6.3.2修改下图
然后保存
6.3重启ssh服务
root@waware:~# systemctl restart sshd