My Original question:

When I run sudo su my zsh prompt changes back to Bash. How can I make Zsh the default shell for the root user?

My answer about duplicate :

The question about when a post is considered as duplicate is debating here : Should questions be closed as duplicate only because of the helpfulness of answers?

I quote the first paragraph of the first answer :

Most opinions I have seen about this say that questions are duplicates, not answers. Therefore, questions should only be closed as a duplicate when they are the same, not because the answer to one is also the answer to the other.

And then the first words after :

I, however, disagree.

You are free to see the post to read the arguments of this user.

I personally, as "most opinions" think that questions are duplicates and no answers because i had never find an answer to my particular question with the post : How do I set fish as the default shell?

And what a coincidence the user that i quoted is one of the users who marks my post as duplicate.

I tried to defend myself but probably in bad way. So please stop down vote my post and please understand that perhaps some people just want to extend already default shell to all users and others want make a particular shell to be default. This is not the same search and i think this can help the community.

  • Just use root instead of your own user name and csh instead of fish. Mar 8, 2018 at 20:39
  • hi @DavidFoerster i think my question is legit and a bit different than the one you purpose. My question is about when we use root user to keep the same shell. My default shell is zsh but when i use root user it changed to ba. h . The first answer in the post you send me does not answer my question ... only the second ... and is for a different shell . My question got a right answer in first position . That's why i think my question is legit and could help some.
    – Gy0m
    Mar 8, 2018 at 20:48
  • Ok, Thanks @Zanna you are really more synthetic than me :)
    – Gy0m
    Mar 8, 2018 at 21:27
  • I think this is a Bad Idea. Many root owned scripts depend on bash features that don't work exactly the same as in zsh
    – waltinator
    Mar 8, 2018 at 21:46
  • 1
    It is absolutely a duplicate. Once you are logged in as root you run chsh and select zsh, exactly as written in the answers to the duplicate question. Mar 10, 2018 at 12:25

2 Answers 2


You have to set the shell for your root account

usermod -s /bin/zsh root

Will do the job

this changes the entry in the /etc/passwd file. They look sth. like this


Where the last entry is the login shell. You can also edit the file manually.

Be careful to set it right. usermod will not check (and you will not be able to login as root):

usermod -s /bin/blargh root
sudo -i
sudo: /bin/blargh: command not found

For a saver way see the answer by @PerlDuck

  • Thanks that is the right solution it works perfectly now
    – Gy0m
    Mar 8, 2018 at 16:23

Apart from usermod there is also the chsh (change shell) utility. It has the advantage that a user can change his own shell without bothering the root user.

I remember it showing a little menu with the available shells and the user can pick one but my current installation does not show such a menu. Perhaps because I don't have additional shells installed (besides bash).

pduck@myhost:~> chsh
Changing the login shell for pduck
Enter the new value, or press ENTER for the default
    Login Shell [/bin/bash]: 
  • 1
    I did not know chsh. I think it is a good option, as it does some checking. (does the file exist, is it executable)
    – mbeyss
    Mar 9, 2018 at 7:52

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