CentOS Single User login mode operation

Source: Internet
Author: User

The/etc/profile file was edited in CentOS for reasons of configuring the JDK environment variable for Java installation

The wrong environment variable configuration causes the profile file to be tested after the first time it is modified and saved, after the Source/etc/profile command is executed

Namely: the javac/java/java-version can obtain the correct verification result;

Random Restart System

Once again arrived at the landing page when the exception: Select the login user click (the right is the window to enter the password), and immediately (time can be ignored) back to select the user window,

Can not be logged on, the interface only shows the waiting clock, no arrows;


1: Reboot the system and press ENTER when entering the countdown for a few seconds

2: Choose the system you want to select, press "E" key to enter

3: Select Kernel Press "E" key to enter edit (edit) page

4: Enter single user login mode after adding a space at the end of the bank

5: Press "B" key to enter the command interface

6: The next step is to modify the wrong/etc/profile file and then exit.

If you can log in correctly, you will be successful. Next Java JDK installation test

No, the original step continues

The following quotes Baidu original http://jingyan.baidu.com/article/948f59242c231fd80ff5f9ec.html

  1. Modify the/etc/profile file

    This method is recommended when this machine is used only as a development, because all users ' shells have the right to use these environment variables when this configuration is used, which may pose a security issue to the system.

    Open/etc/profile with a text editor and add at the end of the profile file:


    Path= $JAVA _home/bin: $PATH

    Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

    Export Java_home

    Export PATH

    Export CLASSPATH

    You can log in again.

  2. 2

    Ii.. Modify the. bashrc file

    This approach is more secure, it can control the permissions that use these environment variables to the user level, and if you need to use these environment variables for a user right, you only need to modify the. bashrc file in the home directory of their individual users.

    Open the. bashrc file in the user directory with a text editor, and at the end of the. bashrc file, add:

    Set java_home=/usr/share/jdk1.6.0_35

    Export Java_home

    Set path= $JAVA _home/bin: $PATH

    Export PATH

    Set classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

    Export CLASSPATH

    Log in again.

  3. 3

    Third, set the variable directly under the shell

    This method is not recommended because the setting is not valid for a different shell. This method is only temporary use, in the future to use the time again to set up, more trouble.

    Simply execute the following command at the shell Terminal:

    Export java_home=/usr/share/jdk1.6.0_35

    Export path= $JAVA _home/bin: $PATH

    Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

    • 1. To change the/USR/SHARE/JDK1.6.0_35JDK to the JDK installation directory

    • 2. Use the colon ":" to separate the paths under Linux

    • 3. $PATH/$CLASSPATH/$JAVA _home is used to refer to the value of the original environment variable when setting the environment variable, it is particularly important to be careful not to overwrite the original value.

    • 4. Current directory in Classpath "." Can't throw it away.

    • 5. Export is exporting these three variables as global variables.

    • 6. The casing must be strictly differentiated.

CentOS Single User login mode operation

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.