最近给openstack创建的虚机(系统CentOS 7 )尝试使用ssh登录时候提示要我用普通账号centos进行登录,无法使用root账号登录
提示信息:
Please login as the user "centos" rather than the user "root".
下面的配置步骤参考了https://cyhour.com/1539/ 这篇文章,对虚机系统进行配置
ssh centos@10.0.0.252切换到root账号
sudo -i配置root密码
passwd打开ssh配置文件
vi /etc/ssh/sshd_config修改或添加下面配置
PermitRootLogin yes PubkeyAuthentication yes编辑认证文件authorized_keys
vi /root/.ssh/authorized_keys
删除
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user "centos" rather than the user "root".';echo;sleep 10"重启ssh服务
systemctl restart sshd测试使用root账号登录
ssh root@10.0.0.252
可以看到登录成功



