-1

I disabled the shell of user root with the command chuser shell=/bin/false root and now I cannot switch to root with sudo su -. PermitRootLogin is disabled too, so I don’t know how could I reestablish the shell of the root user. Any advice?

  • 3
    You learned that it was a bad idea. Get a live system and fix /etc/passwd. – RalfFriedl Sep 25 '18 at 21:16
  • @Goro, i have access to my user's terminal, and can type commands but cannot switch to root – user308669 Sep 25 '18 at 21:24
  • 2
    What kind of sudo access do you have? – Jeff Schaller Sep 25 '18 at 21:50
  • 1
    You can try sudo bash and then running chsh or just sudo chsh and hope it'll work. Either way, consider this a valuable learning experience. – Shadur Sep 27 '18 at 11:57
0

Any other user around who has the permission to edit /etc/passwd and could change the shell back to the original entry? Or any chance to boot the machine into single user mode, if need be with a rescue disk?

  • I have another 3 users in system group(root's group),but i am not sure if one of those could help – user308669 Sep 25 '18 at 21:25
  • Any normal user won't have write access to /etc/passwd. Any normal user won't be able to start a root shell. Single user mode will try to start root's shell. Someone who has stared a root shell before it was changed could change it back. – RalfFriedl Sep 25 '18 at 21:37
0

For what i can read here: Learn the files first, then the commands and here: chuser Command

you should type:

sudo chuser shell=/usr/bin/ksh root

PS: Don't play with the root account unless you know what you are doing and why?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.