假定目前只有root用户,则有如下两种方式可直接登录系统:

方式一:

1. passwd -d root

2. 修改/lib/systemd/system/serial-getty\@.service
#ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I $TERM

方式二:

1.修改/etc/passwd     去掉root后面的x
修改前:root:x:0:0:root:/root:/bin/bash

修改后:root::0:0:root:/root:/bin/bash

2.修改/etc/shadow
修改前:root:$6$KSC.MN5x$d9LfhYpxXPAkrbXbv7uP1df/duNTjqkEiy8BHLJxTOuSrBkwCgcVYS8N/Tvn6fEE
WAqtzKir7uN6a/xozgZQ0C.:17381:0:99999:7:::
修改后:root::17381:0:99999:7:::

3.修改/lib/systemd/system/serial-getty\@.service
#ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
ExecStart=-/sbin/agetty --autologin root 115200,38400,9600 %I $TERM

转载于:https://www.cnblogs.com/aaronLinux/p/10528840.html

Logo

更多推荐