原因是root账户默认在禁止登录的配置文件中
[root@localhost ~]# cat /etc/cockpit/disallowed-users
# List of users which are not allowed to login to Cockpit
root
然后编辑这个配置文件,把root这一行删除
[root@localhost ~]# vim /etc/cockpit/disallowed-users
# List of users which are not allowed to login to Cockpit
root
删除完如下所示
[root@localhost ~]# cat /etc/cockpit/disallowed-users
# List of users which are not allowed to login to Cockpit
然后重启cockpit服务就可以了
[root@localhost ~]# systemctl restart --now cockpit.socket
[root@localhost ~]# systemctl restart --now cockpit.service