How to enter root mode and install gcc in Ubuntu

1. How to enter root mode in Ubuntu

1.1 Create root account

       After the Ubuntu installation is completed, the root account login permission is not available by default. Follow the following steps to complete the root account login in one step after booting.

        During the Ubuntu installation process, only the login user and login password are set, and there is no process of setting the root password; this is because the Ubuntu system automatically generates a root user password when it starts, which is random; but the user can actively modify it.

1.1.1 Step 1: Create root user password

Log in normally, log in to the system as an ordinary user, and create a root user password.

Enter the command in the terminal:

sudo passwd root

       Enter the set password twice. This will complete the setting of the root user password (note that the password is not echoed under the Linux system)

       For details, please jump to 1.2.1 and 1.2.2 of this article to view.

1.1.2 Step 2:Modify the 50-ubuntu.conf file

Enter the command in the terminal:

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

Note, check carefully to make sure you don’t enter the wrong characters. If correct, press Enter to enter the following interface:

Those circled in red do not need to enter manually when entering. Don’t forget to click Save after entering.

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

        After saving, click the cross to exit. If you are not sure whether to save after exiting, you can use the up and down keys on the keyboard to find the command to enter the filesudo gedit /usr/share/lightdm/ lightdm.conf.d/50-ubuntu.conf, enter and view again to ensure the accuracy of every step.

1.1.3 Step 3: Modifygdm-autologin file

Enter the command in the terminal:

sudo gedit /etc/pam.d/gdm-autologin

The following file will open:

Add"#" before the third line to comment out this line. Pay attention to the content of this line, which must be: < /span>

auth required pam_succeed_if.so user != root quiet_success

Don’t make a mistake in adding it, click Save and exit after adding it.

1.1.4 Step 4:Modify the gdm-password file

Enter the command in the terminal:

sudo gedit /etc/pam.d/gdm-password

Open the following file:

Also add"#" before the third line to comment out this line. It must be:

auth required pam_succeed_if.so user != root quiet_success

After adding, click Save and exit.

1.1.5  Fifth step:Modify /root/.profile text

Enter the command in the terminal:

sudo gedit /root/.profile 

Open the following file:

The part circled in red

mesg n 2> /dev/null || true 

changed to:

tty -s&&mesg n || true

As shown below:

1.1.6 Step 6: Shut down the virtual machine

The root account is created.

1.2 Enter root mode

When entering the system, click "Not listed?" as shown below:

importroot

enter password

1.2.1 Method 1 to change root password

First, press and hold "Ctrl+Alt+T" on the keyboard to enter the terminal.

enter:

sudo passwd root

Enter to set a new password. Note that the password needs to be designed to be difficult, otherwise it will be too simple as follows. Of course, it can also be ignored.

1.2.2 Method 2 to change root password

Also on the keyboard, press and hold "Ctrl+Alt+T" to enter the terminal.

enter:

sudo -i

Enter root, enter passwd, and change the password.

2. How to install gcc in Ubuntu

       On the keyboard, hold down "Ctrl+Alt+T", enter the terminal, and enter in terminal mode:

sudo apt install gcc

       Enter the user password. Some may need to click Y to start the installation.

      Get the version information, check whether gcc is installed successfully, enter in terminal mode:

gcc --version

       You can view the current version information, indicating that the installation is successful:

Guess you like

Origin blog.csdn.net/MANONGDKY/article/details/133164240