1

I installed debian stretch yesterday. I installed fish shell . I change the default shell to fish by the following

su chsh -s 'which fish'

Then again enter the this command

su chsh -s `which fish`

Now after I restart the PC I encountered the following error while using "su"

sathish@localhost ~> su
Password: 
Cannot execute which fish: No such file or directory
  • 1
    Unless you have a user with name chsh, the first two commands will fail... – heemayl Jul 3 '17 at 4:50
  • How to solve this @heemayl – Sathish Kumar Jul 3 '17 at 4:52
  • What is your goal? Set fish as the default (login) shell for root? – heemayl Jul 3 '17 at 4:53
  • Yes I need to set fish as my default shell – Sathish Kumar Jul 3 '17 at 4:54
  • You meaning root or satish? – heemayl Jul 3 '17 at 4:56
2

(Since I'm unable to comment. So posting here)

  1. Change user to su

$ su

(Then enter password)

  1. Type

# chsh [username]

In your case:

# chsh root

  1. Enter login shell /usr/bin/fish
  2. That's it. Logout and login again. Should work
  • when I enter the su and after enter password it shows ` sathish@localhost ~> su Password: Cannot execute which fish: No such file or directory ` – Sathish Kumar Jul 3 '17 at 5:22
  • If you installed fish using package manager, the login shell is linked from /usr/bin/fish. Simply enter this when prompted by chsh – user238662 Jul 3 '17 at 5:23
  • 1
    I understand you are unable to login as su right? In that case you might want to have a look at /etc/passwd file. See for root user (The first line generally). For me it's /bin/bash. Edit it to /usr/bin/fish. To edit - su -c 'nano /etc/passwd'. When done, save and exit. Logout and login. – user238662 Jul 3 '17 at 5:35
  • Please consider marking this answer if it helped. – user238662 Jul 3 '17 at 7:41
1

From comments: it is clear that you want to change the login shell for user root to fish. Do:

sudo chsh -s "$(which fish)" root

Or simply:

sudo chsh -s "$(which fish)"

You might have to put absolute path to fish in /etc/shells if not present already (usually done by postinst maintainer script while installation of the package).


If you don't have sudo installed, you have bigger problems to solve IMHO. Anyway, here is the way to do this using su:

su root -c 'chsh -s "$(which fish)"'

You need root's password in this case (as usual).

  • I dont have sudo installed. I tried sathish@localhost /> su chsh -s /usr/bin/fish root No passwd entry for user 'chsh' – Sathish Kumar Jul 3 '17 at 5:19
  • Could you please say where the configuration file for root terminal is stored – Sathish Kumar Jul 3 '17 at 5:24
  • @SathishKumar Check my edits... – heemayl Jul 3 '17 at 5:24
  • Thank You . But it not works same error exists and error throws ' sathish@localhost:~$ su root -c 'chsh -s "$(which fish)"' Password: Cannot execute which fish ` – Sathish Kumar Jul 3 '17 at 5:32
  • @SathishKumar you can't rely on which. Either use command -v fish or type -p fish. Forget everything about which. – Valentin Bajrami Jul 3 '17 at 7:13

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.