1

today I wanted to change my shell to BASH from sh. I have only the root account on my system.

I typed chsh -s /bin/bash but the BASH shell is in the /usr/local/bin/bash. So after a logout I am unable to login to my system. I have no way to chroot (because it's a virtual machine).

Is there any alternative way to get back into the system?

15 Volts
  • 1,969
  • 2
  • 19
  • 34
  • 2
    Reboot into single user mode and change the shell there? Why are you changing root's shell anyway? You should be using a non-privileged user account. – Kusalananda Sep 24 '19 at 06:28
  • I can't change the shell from single user mode. When I try to use the chsh command, it says `chsh: pw_tmp(): Read-only file system` – 15 Volts Sep 24 '19 at 06:38
  • 1
    Then remount the root partition as `rw`. `mount -u -o rw /` or something similar. – Kusalananda Sep 24 '19 at 06:40
  • Yes, that worked... It's so different from GNU/Linux, so I tried creating a symbolic link to /bin/bash... Thanks a lot! – 15 Volts Sep 24 '19 at 06:49
  • 1
    I wouldn't create that symbolic link. Just reset the root user's shell to whatever it was from the start and create another user. If you want `bash` for that user, use `/usr/local/bin/bash`. – Kusalananda Sep 24 '19 at 08:37
  • 1
    **If** you have another account that can `su` to root you can run `su -s /usr/local/bin/bash` and then run `chsh` again. Or if that user can run `chsh` from sudo: `sudo chsh -s /usr/local/bin/bash root`. – cas Sep 25 '19 at 02:22

0 Answers0