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]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








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 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.










share|improve this question















marked as duplicate by David Foerster, waltinator, Charles Green, muru bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

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 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










  • 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






  • 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














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 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.










share|improve this question















marked as duplicate by David Foerster, waltinator, Charles Green, muru bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

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 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










  • 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






  • 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












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 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.










share|improve this question
















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 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.





This question already has an answer here:



  • How do I set fish as the default shell?

    5 answers







bash user-management zsh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 12 at 21:58

























asked Mar 8 at 15:18









Gy0m

761112




761112




marked as duplicate by David Foerster, waltinator, Charles Green, muru bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

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 bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

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 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










  • 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






  • 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











  • 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 on bash features that don't work exactly the same as in zsh
    – 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










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






share|improve this answer






















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

















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]:





share|improve this answer
















  • 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

















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






share|improve this answer






















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














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






share|improve this answer






















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












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






share|improve this answer














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







share|improve this answer














share|improve this answer



share|improve this answer








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
















  • 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












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]:





share|improve this answer
















  • 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














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]:





share|improve this answer
















  • 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












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]:





share|improve this answer












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]:






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 8 at 18:31









PerlDuck

3,95811030




3,95811030







  • 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












  • 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







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


Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491