私钥登录,改成密码登录

新建一个实例后,会生成一个私钥A

使用私钥A远程登录服务器

导入私钥A,文件无格式要求

 设置密码

输入passwd root后会提示输入new password,输入一个root的密码,需要再输入一遍进行验证

passwd root

修改配置文件

vi /etc/ssh/sshd_config

把PermitRootLogin yes前的注释去掉

#PermitRootLogin yes

 把 PasswordAuthentication yes前的注释去掉

#PasswordAuthentication yes

重启服务

systemctl restart sshd.service

使用密码登录

猜你喜欢

转载自blog.csdn.net/qq_38312411/article/details/128799303