2

I'm trying to become the root on my terminal with sudo -i command, but the system display sudo: /usr/local/bin/fish: command not found. I tried to set the fish shell as default, but I got a problem. Could anyone be able to tell me what I could do to fix the problem?

I tried to set fish shell as default with first sudo echo /usr/local/bin/fish >> /etc/shells and after chsh -s /usr/local/bin/fish. However, it looks like I have more than one usr/local/bin/fish file in /usr/shells. (In fact, I followed from there)

Thanks in advance!

P.S. I know now the file is not usr/local/bin/fish, but usr/local/bin. I've succeeded to set fish shell as default, but I'm still having the sudo -i problem.

1 Answers1

6

To replace a bad default shell for root with fish:

  1. Install fish (with sudo apt install fish if you want Ubuntu's package)
  2. Run sudo nano /etc/pam.d/chsh
  3. Insert a # in front of the line auth required pam_shells.so
  4. Save and exit by pressing Ctrl+O, Enter, Ctrl+X
  5. Run sudo chsh -s $(which fish) (remove the $ if you're doing all this within fish)
  6. Run sudo nano /etc/pam.d/chsh
  7. Remove the # you inserted
  8. Save and exit by pressing Ctrl+O, Enter, Ctrl+X

Now, you can test that the shell is set properly with sudo -i.

Chai T. Rex
  • 5,193