ubuntu server root用户自动登录

添加启动的账户名

sudo vi /etc/systemd/system/getty.target.wants/getty@tty1.service

如图中的 ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I $TERM   中添加自启动root用户 -a root

 

设置免密码登陆:

sudo vim /etc/passwd

将图中的 root:x:0:0:root:/root:/bin/bash 去掉x改为 root::0:0:root:/root:/bin/bash

 

最后重启测试

posted @ 2021-05-14 14:52  漆天初晓  阅读(868)  评论(0编辑  收藏  举报