I use zsh as my regular user, but when I use root my shell is Bash. How can I use Zsh for root too? [duplicate]
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
This question already has an answer here:
How do I set fish as the default shell?
5 answers
My Original question:
When I run
sudo su
myzsh
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.
bash user-management zsh
marked as duplicate by David Foerster, waltinator, Charles Green, muru
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 8 at 22:28
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
 |Â
show 3 more comments
up vote
0
down vote
favorite
This question already has an answer here:
How do I set fish as the default shell?
5 answers
My Original question:
When I run
sudo su
myzsh
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.
bash user-management zsh
marked as duplicate by David Foerster, waltinator, Charles Green, muru
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 8 at 22:28
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Just useroot
instead of your own user name andcsh
instead offish
.
â David Foerster
Mar 8 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 at 20:48
Ok, Thanks @Zanna you are really more synthetic than me :)
â Gy0m
Mar 8 at 21:27
I think this is a Bad Idea. Manyroot
owned scripts depend onbash
features that don't work exactly the same as inzsh
â waltinator
Mar 8 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.
â Andrea Lazzarotto
Mar 10 at 12:25
 |Â
show 3 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
How do I set fish as the default shell?
5 answers
My Original question:
When I run
sudo su
myzsh
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.
bash user-management zsh
This question already has an answer here:
How do I set fish as the default shell?
5 answers
My Original question:
When I run
sudo su
myzsh
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.
This question already has an answer here:
How do I set fish as the default shell?
5 answers
bash user-management zsh
bash user-management zsh
edited Mar 12 at 21:58
asked Mar 8 at 15:18
![](https://lh3.googleusercontent.com/-5BB-76UixdI/AAAAAAAAAAI/AAAAAAAAAsI/hc6O4l9t38k/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-5BB-76UixdI/AAAAAAAAAAI/AAAAAAAAAsI/hc6O4l9t38k/photo.jpg?sz=32)
Gy0m
761112
761112
marked as duplicate by David Foerster, waltinator, Charles Green, muru
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 8 at 22:28
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by David Foerster, waltinator, Charles Green, muru
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 8 at 22:28
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Just useroot
instead of your own user name andcsh
instead offish
.
â David Foerster
Mar 8 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 at 20:48
Ok, Thanks @Zanna you are really more synthetic than me :)
â Gy0m
Mar 8 at 21:27
I think this is a Bad Idea. Manyroot
owned scripts depend onbash
features that don't work exactly the same as inzsh
â waltinator
Mar 8 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.
â Andrea Lazzarotto
Mar 10 at 12:25
 |Â
show 3 more comments
Just useroot
instead of your own user name andcsh
instead offish
.
â David Foerster
Mar 8 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 at 20:48
Ok, Thanks @Zanna you are really more synthetic than me :)
â Gy0m
Mar 8 at 21:27
I think this is a Bad Idea. Manyroot
owned scripts depend onbash
features that don't work exactly the same as inzsh
â waltinator
Mar 8 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.
â Andrea Lazzarotto
Mar 10 at 12:25
Just use
root
instead of your own user name and csh
instead of fish
.â David Foerster
Mar 8 at 20:39
Just use
root
instead of your own user name and csh
instead of fish
.â David Foerster
Mar 8 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 at 20:48
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 at 20:48
Ok, Thanks @Zanna you are really more synthetic than me :)
â Gy0m
Mar 8 at 21:27
Ok, Thanks @Zanna you are really more synthetic than me :)
â Gy0m
Mar 8 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 at 21:46
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 at 21:46
1
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.
â Andrea Lazzarotto
Mar 10 at 12:25
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.
â Andrea Lazzarotto
Mar 10 at 12:25
 |Â
show 3 more comments
2 Answers
2
active
oldest
votes
up vote
7
down vote
accepted
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
Thanks that is the right solution it works perfectly now
â Gy0m
Mar 8 at 16:23
add a comment |Â
up vote
3
down vote
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]:
1
I did not knowchsh
. I think it is a good option, as it does some checking. (does the file exist, is it executable)
â mbeyss
Mar 9 at 7:52
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
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
Thanks that is the right solution it works perfectly now
â Gy0m
Mar 8 at 16:23
add a comment |Â
up vote
7
down vote
accepted
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
Thanks that is the right solution it works perfectly now
â Gy0m
Mar 8 at 16:23
add a comment |Â
up vote
7
down vote
accepted
up vote
7
down vote
accepted
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
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
edited Mar 9 at 7:56
answered Mar 8 at 15:59
mbeyss
59816
59816
Thanks that is the right solution it works perfectly now
â Gy0m
Mar 8 at 16:23
add a comment |Â
Thanks that is the right solution it works perfectly now
â Gy0m
Mar 8 at 16:23
Thanks that is the right solution it works perfectly now
â Gy0m
Mar 8 at 16:23
Thanks that is the right solution it works perfectly now
â Gy0m
Mar 8 at 16:23
add a comment |Â
up vote
3
down vote
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]:
1
I did not knowchsh
. I think it is a good option, as it does some checking. (does the file exist, is it executable)
â mbeyss
Mar 9 at 7:52
add a comment |Â
up vote
3
down vote
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]:
1
I did not knowchsh
. I think it is a good option, as it does some checking. (does the file exist, is it executable)
â mbeyss
Mar 9 at 7:52
add a comment |Â
up vote
3
down vote
up vote
3
down vote
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]:
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]:
answered Mar 8 at 18:31
![](https://i.stack.imgur.com/kCmqs.png?s=32&g=1)
![](https://i.stack.imgur.com/kCmqs.png?s=32&g=1)
PerlDuck
3,95811030
3,95811030
1
I did not knowchsh
. I think it is a good option, as it does some checking. (does the file exist, is it executable)
â mbeyss
Mar 9 at 7:52
add a comment |Â
1
I did not knowchsh
. I think it is a good option, as it does some checking. (does the file exist, is it executable)
â mbeyss
Mar 9 at 7:52
1
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 at 7:52
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 at 7:52
add a comment |Â
Just use
root
instead of your own user name andcsh
instead offish
.â David Foerster
Mar 8 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 at 20:48
Ok, Thanks @Zanna you are really more synthetic than me :)
â Gy0m
Mar 8 at 21:27
I think this is a Bad Idea. Many
root
owned scripts depend onbash
features that don't work exactly the same as inzsh
â waltinator
Mar 8 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.
â Andrea Lazzarotto
Mar 10 at 12:25