Ubuntu suddenly can not login, enter the password correctly always return to the login screen

Source: Internet
Author: User

Problem description

Since the configuration Eclipse command started, I modified the contents of the/etc/environment file, with the command shutdown-r-now Restart, enter the password correctly always return to the login screen.

Check the information on the Internet: The system starts by invoking the environment in the profile, then calls the environment in environment, and when the environment has the same name in the profiles, profile inherits the environment environment. Otherwise it will cause the environment in the environment to fail, and the environment variables in the profile are ordered, and the order is reversed.

That is, I modified the/etc/environment must have a problem.

Under the VM, how to change back? On the internet for half a day, did not meet the specific method, spent a lot of kung fu, finally tried to solve the problem.

Solution steps

1. Ctrl + Alt + F1 into command line tty1

2. Login with username (my is LSK) password

3, use the Complete VI path command: /usr/bin/vi/etc/environment for the VI command line mode (Command mode/general mode)

4. Input i into text input mode (input mode/edit mode)

5. Kill the statement of your own configuration

6. Press ESC to return to command line mode

7. Input: Enter the final line mode (last lines mode/command mode)

8, enter W! /usr/bin/sudo Tee% Complete modification (NOTE: W Space! Space/usr/bin/sudo Space Tee space%, because /etc/environment is readonly, so you need to use this command)

9, enter: Q! exit VI, and then enter exit exit, press CTRL + ALT + F7 re-enter the desktop

Note: Under Tty1, it is possible to use the CD command, and all other similar ls/sudo/vi must have a full path.

Additional: three Modes of VI

command-line mode (Command mode/general mode)
at any time, no matter what mode the user is in, just click the " ESC " key to get VI into the command line mode; we are in the shell environment (prompt is $ Enter the start VI command, which is also in this mode when you enter the editor.
In this mode, users can enter various legal VI commands for managing their own documents. Any character entered from the keyboard is interpreted as an edit command, and if the input character is a valid VI command, VI completes the corresponding action after accepting the user command. Note, however, that the commands you enter are not displayed on the screen. If the input character is not a legal command of VI, VI will ring the alarm.
 
text input mode (input mode/edit mode)
Enter insert command I (insert) in command mode, attach command A (append), open the Command O (open), Modify command C (change), replace command R, or replace command s to enter text input mode. In this mode, any characters entered by the user are saved by VI as the contents of the file and displayed on the screen. In the text input process, if you want to go back to command mode, press the " ESC " key. The

last-line mode/command-line mode
Last-row mode is also known as ex-escape mode. The functions of the
VI and ex editors are the same, the main difference being the user interface. In VI, commands are usually a single key, such as I, A, O, etc., whereas in ex, the command is the body line that ends with a hit return. VI has a dedicated "escape" command to access many of the line-oriented ex commands. In command mode, the user presses the ":" Key to enter the last row mode, at which time VI displays a ":" As a prompt in the final row of the display window (usually the last line of the screen), waiting for the user to enter a command. Most file management commands are executed in this mode (such as writing the contents of the edit buffer to a file medium). After the last command is executed, VI automatically returns to the command mode.

Ubuntu Suddenly can't login, enter the password correctly always return to the login screen

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.