Ubuntu 18.04 obtains root permissions and logs in as root user

Ubuntu 18.04 obtains root permissions and logs in as root user

Written in advance: In the following steps, you need to enter commands in the terminal. Friends who view the blog on the computer can directly copy and paste it into the terminal. Friends who view it on the mobile phone please note that the spaces in the command are required, otherwise the operation will fail.

1. Set the initial password for root

(1) Log in to the system, open the terminal, and enter the command:

sudo passwd root

(Set a password for the root user)

(2) Set a root password (it is recommended to keep it simple, it does not need to be complicated);

(3) Repeat the root password;

2. Modify the content of /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf file

Terminal input:

sudo gedit /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

Open the file and add the following two lines at the end of the file. Save and close it after completion (pay attention to this step, do not delete the original two lines in the file);

greeter-show-manual-login=true
all-guest=false

3. Enter the /etc/pam.d folder and modify the contents of the gdm-autologin and gdm-password files (refer to the command in step 2):

gdm-autologin file comment out the line auth required pam_success_if.so user!=root quiet_success

gdm-password file comment out the line auth required pam_success_if.so user!=root quiet_success

Note: To make a comment, just add "#" before the line, for example:

#auth required pam_success_if.so user!=root quiet_success

4. Modify the /root/.profile file

Terminal input:

sudo gedit /root/.profile

Open the file and change the last line to the following:

tty -s && mesg n || true

Save and close, restart, and after restarting, select "Not Listed" and enter the account root and password;

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Ubuntu 20.04 desktop installation and root permission activation and ssh installation details
  • Use MySQL to open/modify port 3306 and open access permissions in Ubuntu/Linux environment
  • How to control the permissions of ordinary users when mounting ext4 formatted hard disk in Ubuntu 16.04
  • Solution to the problem of unable to switch root permissions in Ubuntu 16.04
  • How to add/delete file permissions in Linux (Ubuntu)
  • Ubuntu uses the root user to log in/switch root permissions
  • Ubuntu/Linux command analysis for permission modification
  • Ubuntu does not have enough permissions to create a folder solution

<<:  A simple method to merge and remove duplicate MySQL tables

>>:  Nodejs converts JSON string into JSON object error solution

Recommend

Two ways to implement square div using CSS

Goal: Create a square whose side length is equal ...

Vue+el-table realizes merging cells

This article example shares the specific code of ...

Implementation of Nginx Intranet Standalone Reverse Proxy

Table of contents 1 Nginx Installation 2 Configur...

JavaScript BOM location object + navigator object + history object

Table of contents 1. Location Object 1. URL 2. Pr...

Detailed explanation of JavaScript state container Redux

Table of contents 1. Why Redux 2. Redux Data flow...

Vue ElementUI implements asynchronous loading tree

This article example shares the specific code of ...

Test and solution for MySQL's large memory usage and high CPU usage

After the changes: innodb_buffer_pool_size=576M -...

Use Xshell to connect to the Linux virtual machine on VMware (graphic steps)

Preface: I recently started to study the construc...

CSS3 speeds up and delays transitions

1. Use the speed control function to control the ...

NULL and Empty String in Mysql

I recently came into contact with MySQL. Yesterda...

Detailed explanation of JavaScript upload file limit parameter case

Project scenario: 1. Upload file restrictions Fun...

Use scripts to package and upload Docker images with one click

The author has been working on a micro-frontend p...

Detailed analysis of the usage and application scenarios of slots in Vue

What are slots? We know that in Vue, nothing can ...

Solution to the problem of not finding Tomcat configuration in Intelli Idea

I joined a new company these two days. The compan...