In linux, after an error occurs in modifying the profile file, all commands cannot be used. How can this problem be solved ?, Linuxprofile

Source: Internet
Author: User

In linux, after an error occurs in modifying the profile file, all commands cannot be used. How can this problem be solved ?, Linuxprofile
Scenario

Today, we installed linux for the second time, and there were more new ones.

I was supposed to configure the java environment variable in/etc/profile. I got it wrong: enter it as;, and then all the commands except cd went wrong.

You cannot log on to the system after restarting.

Therefore, we tried two solutions.

Method 1

This is the first time that I have been unable to log on to the system. I thought I was about to reload the system. I thought it was definitely the profile error, so I thought it would be nice to change it back in the recovery mode.

Enter the recovery mode to enter the root account. Of course, if your password is forgotten, you can use the passwd command to modify the password. In this case, you will find that all files are read-only even though they are root users, in addition, vi is not easy to use in the root, enter the command: mount-o remount, rw/assign the read and write permissions to all files in the/directory to modify the file with an error, that is, the/etc/profile file, and then reboot

Method 2

At first, I thought it was an error when I configured the environment. Then I tried it again, and then I couldn't enter it. At this time, I didn't feel like I was thinking about the usage. I thought it would be more convenient.

Run the following command: export PATH =/usr/bin:/usr/sbin:/bin:/sbin, reconfigure the PATH environment variable and change/etc/profile back to source/etc/profile.

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.