With the wrong default environment is not terrible,Well matched back like a big deal。
Obviously,He says such things there is no story。
Anyway,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。
In the advanced options also select the second "Recovery mode.",Then e to edit the parameters:
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,Anyway,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:
1 2 3 4 5 6 7 |
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync ... |
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
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)。
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。