Why Fedora needs to use the 'lchsh' command to change the default shell?

Hello Friends

About to install Oh My Zsh it requires to have installed first zsh. Of course it has sense. Now in the Oh My Zsh documentation has the following section:

where is indicated:

Make it your default shell: chsh -s $(which zsh) or use sudo lchsh $USER if you are on Fedora.

If you use lchsh you need to type /bin/zsh to make it your default shell.

Now being curious

Question

  • Why Fedora needs to use the lchsh command to change the default shell?

I am not sure if it is the solution to:

But Why is not enough the chsh command?

Furthermore if in google is applied the two following search patterns:

  • linux chsh tutorial
  • linux lchsh tutorial

The former has a lot of results and the latter practically nothing

Thanks for your understanding

2 Likes

It doesn’t. You can use chsh same way as any other linux or unix system. The lchsh is just an alternative way to do the same thing. In addition, lchsh can be used to change the shell of another user, as long as you have sudo permission.

The chsh command checks /etc/shells to check if the new shell is a valid one, and currently valid shells are

/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/bin/csh
/bin/tcsh
/usr/bin/csh
/usr/bin/tcsh
/bin/dash

If you want to use /bin/zsh, you have to edit this file and add /bin/zsh to that file.

2 Likes