It's very weird that after switching to zsh from bash, I can't access root.
I normally use 'su' to login as root after I login as a normal user (username is normalusername) with less privileges. And it was always nice. But after switching root shell from bash to zsh, when I try to login via su, I got:
normalusername@(none):~$ su
Password: (enter the correct password)
Cannot execute zsh: No such file or directory
When I access root directly via ssh from my Mac, I got:
localhost:~ myname$ ssh -lroot 106.186.120.20
root@106.186.120.20's password: (enter the correct/incorrect password)
Permission denied, please try again.
No matter whether I entered the correct password, it comes again and again.
So I intentionally entered a wrong password with "su" from a normal user, I got:
normalusername@(none):~$ su
Password: (entered a wrong password and pressed enter)
(pressed enter)
su: Authentication failure
After entering the incorrect password I didn't see anything, I typed enter twice and then got the su: Authentication failure result.
I tried for many times and the conclusion is:
- If I enter the correct password, it will tell me that "Cannot execute zsh: No such file or directory"
- If I enter the incorrect password, it will not showing up anything until I hit enter for 2-6 times.
It seems to be an indication that I didn't just forget the "correct password". But how can I access root anyway?
The entry in /etc/passwd is
root:x:0:0:root:/root:zsh
root:x:0:0:root:/root:zshso it should beroot:x:0:0:root:/root:/bin/zshinstead, right? How could I fix this? Thanks! – AGamePlayer Jan 04 '15 at 13:36chshallows you to change a user's shell. If you can't use it, or can't get permissions to, try to edit/etc/passwddirectly. You may needsudoat some point ;) – John WH Smith Jan 04 '15 at 13:49sudo vim /etc/passwdto edit it, before I was asked to enter a password, I gotsudo: unable to resolve host (none)then I was prompted to enter the password for my current user. I entered and then I got this:normalusername is not in the sudoers file. This incident will be reported.– AGamePlayer Jan 04 '15 at 13:56sh -s /bin/bash, then fix the problem. – ctrl-alt-delor Jan 17 '17 at 18:16sudoon some systems being in groupsudowill allow you to use sudo with full privileges. I would recommendsudooversu. – ctrl-alt-delor Jan 17 '17 at 18:19