1

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.

Gy0m
  • 311

2 Answers2

8

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

root:x:0:0:root:/root:/bin/bash

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

mbeyss
  • 1,038
3

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
Password: 
Changing the login shell for pduck
Enter the new value, or press ENTER for the default
    Login Shell [/bin/bash]: 
PerlDuck
  • 13,885