The Linux system sets the default user to be root and logs in automatically (detailed explanation, including Centos and Ubuntu systems)

1. Centos system

1. After logging in as an ordinary user, first create a password for the super user root.

2. Switch to the root user through the su command

3. Change the default login account of the file to root


Open /etc/gdm/custom.conf
vi /etc/gdm/custom.conf or nano /etc/gdm/custom.conf (depend on which command you are familiar with) )


Write under file [daemon] ( Note: Write under this, do not Invalid writing!):
AutomaticLoginEnable=True
AutomaticLogin=root

Then save it and restart Reboot.

2. Ubuntu system


1. Set a password for root and test login and exit


Open the terminal, open the root account, and set the password:

sudo passwd  root

 Test root user login

su -
After successful login, you can log out as a normal user to continue the subsequent operations

exit


2. Modify the contents of the 50-ubuntu.conf configuration file


File location/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf (if there is no such file, go to this directory to find a similar file)
sudo chmod 777 /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
Add two lines of code at the end of the file
greeter-show-manual- login=true
all-guest=false

3. Modify the gdm-autologin and gdm-passwd files


Enter the /etc/pam.d folder and find the gdm-autologin and gdm-passwd files (if not, look for similar files)
sudo chmod 777 /etc/pam.d /gdm-autologin
sudo chmod 777 /etc/pam.d/gdm-password

Comment out the line auth required pam_success_if.so user!=root quiet_success in both files


Modify the /root/.profile file
Find the .profile file to be modified. This file is a hidden file. If not, check the option box
Enable root permissions, open the file, comment out the last line, and then add another line
tty -s&&mesg n || true

4. Find the custom.conf configuration file and modify it


The folder path is /etc/gdm3/ (if not, find a similar folder, for example: /gdm)

Modify files

TimedLoginEnable=false
AutomaticLoginEnable=true #设为true
TimedLogin=root #设成root
AutomaticLogin=root #设成root
TimedLoginDelay=10

AutomaticLoginEnable=true #Set to true
AutomaticLogin=root #Set to root

 

Guess you like

Origin blog.csdn.net/weixin_68971793/article/details/132965884