Chsh -s mismatch with how to shell the rescue?

With the wrong default environment is not terrible,Well matched back like a big deal。

Obviously,He says such things there is no story。


In short,If you find that your vps One day suddenly can not log in,The content is not being given no authority,But the certificate is to determine the right - then you might be wrong with the last exit before the shell。At this time, even if you use the console to log on,After logging will find immediately flashed back to the login screen - finished,You thought,Just with a good environment, we have to do it all again。

use chsh The default shell is a key switching very dangerous thing,Best not to mistype,Or you would gg。

at this time,You can try to send control console in years + alt + delete to restart,In the fleeting grub Start interface,Press the arrow keys to stop the automatic start (if you miss,To do it again, right),To move the highlight to the "Advanced Options",The default is English,But this does not affect your choice,The second theory is。

Select Advanced Options

In the advanced options also select the second "Recovery mode.",Then e to edit the parameters:

Select the Advanced option in the recovery mode

Edit startup parameters,Be careful not to mistake

The figure in the parameters ro recovery nomodeset To rw single init=/bin/bash

Then press ctrl + x to perform,So you enter into single-user mode Linux,,Here you do not need to enter the root password to gain root privileges - of course,Here it seems your root password is invalid,In short,Now you can change back to the default shell - but not by chsh,This is something that password authorization,However, you can never enter the correct password。

Fortunately, all Linux configuration are written in a configuration file,We direct editing /etc/passwd ,Information which is the root of the first row:

No matter what you changed,According to the above code,The root of the shell changed /bin/bash You can restore the default,If you're like me with zsh,Then write /bin/zsh ,After saving the restart to return to normal。

"I think I can ......,To rescue it? "

Original article written by LogStudio:R0uter's Blog » Chsh -s mismatch with how to shell the rescue?

Reproduced Please keep the source and description link:https://www.logcg.com/archives/3003.html

About the Author

R0uter

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Comments

  1. After the single-user mode is not changed init added with no single (single-user mode as a system concept init,However, it is you replace a)。

    chsh wrong root login shell on the past to change the chant。I generally do not use root for routine operations,Do not go and change the default shell root,Otherwise experience problems (error correction or unloading or with the wrong shell) too pit (the server how can easily restart it,Especially individuals and small groups to use,No backup service)。

    1. Embarrassing is that if you hand cheap to the root shell into a path that does not exist,Then no other login account on the machine ..................
      At this time only need to restart it without reloading ...... it is a very lucky thing。

Leave a Reply

Your email address will not be published. Required fields are marked *