How do I change my default shell on a AWS instance?












119















I want to change my shell from the default bash shell to zsh on my Amazon EC2 instances. How do I go about doing it? Thanks!










share|improve this question





























    119















    I want to change my shell from the default bash shell to zsh on my Amazon EC2 instances. How do I go about doing it? Thanks!










    share|improve this question



























      119












      119








      119


      43






      I want to change my shell from the default bash shell to zsh on my Amazon EC2 instances. How do I go about doing it? Thanks!










      share|improve this question
















      I want to change my shell from the default bash shell to zsh on my Amazon EC2 instances. How do I go about doing it? Thanks!







      shell amazon-ec2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 23 '15 at 0:34









      Braiam

      4,03631851




      4,03631851










      asked Jan 11 '11 at 11:31









      Shripad KrishnaShripad Krishna

      696277




      696277






















          4 Answers
          4






          active

          oldest

          votes


















          155














          Try using the chsh command.



          e.g.



          chsh -s /bin/zsh


          You can confirm the location of zsh by running whereis zsh, or alternatively simply run



          chsh -s $(which zsh)


          If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:



          sudo chsh -s $(which zsh) john


          Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.






          share|improve this answer


























          • I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)

            – Shripad Krishna
            Jan 11 '11 at 11:45






          • 3





            @Paddy if you are root you can change it for another user by running chsh -s /bin/zsh username.

            – John T
            Jan 11 '11 at 11:47













          • Awesome :) Much easier. Thanks for that info too.

            – Shripad Krishna
            Jan 11 '11 at 11:48






          • 3





            @We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells

            – Nate Parsons
            Jun 4 '13 at 17:54






          • 4





            I use a lightly different version sudo chsh -s $(which zsh) $(whoami)

            – SergioAraujo
            Apr 30 '15 at 19:37



















          19














          Open /etc/passwd:



          sudo vi /etc/passwd


          Find the line with your username:



          username:x:1634231:100:Your Name:/home/username:/bin/bash


          and replace bash with zsh:



          username:x:1634231:100:Your Name:/home/username:/bin/zsh


          Log out and log in back for the changes to take effect.






          share|improve this answer



















          • 6





            It's better to use chsh, but if you're really going to edit /etc/passwd by hand, at least use the vipw command.

            – Valmiky Arquissandas
            Aug 14 '14 at 2:58











          • I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?

            – Georgii Oleinikov
            Aug 14 '14 at 16:44











          • Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!

            – Andrew
            Sep 12 '17 at 18:23



















          4














          On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...



          To get over this problem, do this:




          • Right click in terminal

          • Profiles -> Profile Preferences

          • Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.

          • Restart Terminal.


          Peace.



          P.S. Don't have 10 reputation to post images, so all texty instructions. :)






          share|improve this answer
























          • You have the rep you need now. :P

            – pradyunsg
            Mar 21 '16 at 8:43



















          2














          I came here to just add more additional information.
          If you have troubles when install zsh in Amazon Linux AMI by Amazon, like when you run:



          sudo chsh $(which zsh) : // chsh command not found


          Then you should install util-linux-user:



          sudo yum install util-linux-user


          (by default Amazon Linux AMI only has lchsh, but I can not figure how it work).



          Then run the following command, it should work:



          sudo chsh -s $(which zsh) $(whoami)





          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f231735%2fhow-do-i-change-my-default-shell-on-a-aws-instance%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            155














            Try using the chsh command.



            e.g.



            chsh -s /bin/zsh


            You can confirm the location of zsh by running whereis zsh, or alternatively simply run



            chsh -s $(which zsh)


            If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:



            sudo chsh -s $(which zsh) john


            Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.






            share|improve this answer


























            • I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)

              – Shripad Krishna
              Jan 11 '11 at 11:45






            • 3





              @Paddy if you are root you can change it for another user by running chsh -s /bin/zsh username.

              – John T
              Jan 11 '11 at 11:47













            • Awesome :) Much easier. Thanks for that info too.

              – Shripad Krishna
              Jan 11 '11 at 11:48






            • 3





              @We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells

              – Nate Parsons
              Jun 4 '13 at 17:54






            • 4





              I use a lightly different version sudo chsh -s $(which zsh) $(whoami)

              – SergioAraujo
              Apr 30 '15 at 19:37
















            155














            Try using the chsh command.



            e.g.



            chsh -s /bin/zsh


            You can confirm the location of zsh by running whereis zsh, or alternatively simply run



            chsh -s $(which zsh)


            If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:



            sudo chsh -s $(which zsh) john


            Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.






            share|improve this answer


























            • I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)

              – Shripad Krishna
              Jan 11 '11 at 11:45






            • 3





              @Paddy if you are root you can change it for another user by running chsh -s /bin/zsh username.

              – John T
              Jan 11 '11 at 11:47













            • Awesome :) Much easier. Thanks for that info too.

              – Shripad Krishna
              Jan 11 '11 at 11:48






            • 3





              @We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells

              – Nate Parsons
              Jun 4 '13 at 17:54






            • 4





              I use a lightly different version sudo chsh -s $(which zsh) $(whoami)

              – SergioAraujo
              Apr 30 '15 at 19:37














            155












            155








            155







            Try using the chsh command.



            e.g.



            chsh -s /bin/zsh


            You can confirm the location of zsh by running whereis zsh, or alternatively simply run



            chsh -s $(which zsh)


            If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:



            sudo chsh -s $(which zsh) john


            Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.






            share|improve this answer















            Try using the chsh command.



            e.g.



            chsh -s /bin/zsh


            You can confirm the location of zsh by running whereis zsh, or alternatively simply run



            chsh -s $(which zsh)


            If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:



            sudo chsh -s $(which zsh) john


            Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 25 '14 at 19:08









            Heptite

            14.8k54157




            14.8k54157










            answered Jan 11 '11 at 11:36









            John TJohn T

            142k20293329




            142k20293329













            • I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)

              – Shripad Krishna
              Jan 11 '11 at 11:45






            • 3





              @Paddy if you are root you can change it for another user by running chsh -s /bin/zsh username.

              – John T
              Jan 11 '11 at 11:47













            • Awesome :) Much easier. Thanks for that info too.

              – Shripad Krishna
              Jan 11 '11 at 11:48






            • 3





              @We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells

              – Nate Parsons
              Jun 4 '13 at 17:54






            • 4





              I use a lightly different version sudo chsh -s $(which zsh) $(whoami)

              – SergioAraujo
              Apr 30 '15 at 19:37



















            • I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)

              – Shripad Krishna
              Jan 11 '11 at 11:45






            • 3





              @Paddy if you are root you can change it for another user by running chsh -s /bin/zsh username.

              – John T
              Jan 11 '11 at 11:47













            • Awesome :) Much easier. Thanks for that info too.

              – Shripad Krishna
              Jan 11 '11 at 11:48






            • 3





              @We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells

              – Nate Parsons
              Jun 4 '13 at 17:54






            • 4





              I use a lightly different version sudo chsh -s $(which zsh) $(whoami)

              – SergioAraujo
              Apr 30 '15 at 19:37

















            I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)

            – Shripad Krishna
            Jan 11 '11 at 11:45





            I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :)

            – Shripad Krishna
            Jan 11 '11 at 11:45




            3




            3





            @Paddy if you are root you can change it for another user by running chsh -s /bin/zsh username.

            – John T
            Jan 11 '11 at 11:47







            @Paddy if you are root you can change it for another user by running chsh -s /bin/zsh username.

            – John T
            Jan 11 '11 at 11:47















            Awesome :) Much easier. Thanks for that info too.

            – Shripad Krishna
            Jan 11 '11 at 11:48





            Awesome :) Much easier. Thanks for that info too.

            – Shripad Krishna
            Jan 11 '11 at 11:48




            3




            3





            @We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells

            – Nate Parsons
            Jun 4 '13 at 17:54





            @We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells

            – Nate Parsons
            Jun 4 '13 at 17:54




            4




            4





            I use a lightly different version sudo chsh -s $(which zsh) $(whoami)

            – SergioAraujo
            Apr 30 '15 at 19:37





            I use a lightly different version sudo chsh -s $(which zsh) $(whoami)

            – SergioAraujo
            Apr 30 '15 at 19:37













            19














            Open /etc/passwd:



            sudo vi /etc/passwd


            Find the line with your username:



            username:x:1634231:100:Your Name:/home/username:/bin/bash


            and replace bash with zsh:



            username:x:1634231:100:Your Name:/home/username:/bin/zsh


            Log out and log in back for the changes to take effect.






            share|improve this answer



















            • 6





              It's better to use chsh, but if you're really going to edit /etc/passwd by hand, at least use the vipw command.

              – Valmiky Arquissandas
              Aug 14 '14 at 2:58











            • I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?

              – Georgii Oleinikov
              Aug 14 '14 at 16:44











            • Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!

              – Andrew
              Sep 12 '17 at 18:23
















            19














            Open /etc/passwd:



            sudo vi /etc/passwd


            Find the line with your username:



            username:x:1634231:100:Your Name:/home/username:/bin/bash


            and replace bash with zsh:



            username:x:1634231:100:Your Name:/home/username:/bin/zsh


            Log out and log in back for the changes to take effect.






            share|improve this answer



















            • 6





              It's better to use chsh, but if you're really going to edit /etc/passwd by hand, at least use the vipw command.

              – Valmiky Arquissandas
              Aug 14 '14 at 2:58











            • I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?

              – Georgii Oleinikov
              Aug 14 '14 at 16:44











            • Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!

              – Andrew
              Sep 12 '17 at 18:23














            19












            19








            19







            Open /etc/passwd:



            sudo vi /etc/passwd


            Find the line with your username:



            username:x:1634231:100:Your Name:/home/username:/bin/bash


            and replace bash with zsh:



            username:x:1634231:100:Your Name:/home/username:/bin/zsh


            Log out and log in back for the changes to take effect.






            share|improve this answer













            Open /etc/passwd:



            sudo vi /etc/passwd


            Find the line with your username:



            username:x:1634231:100:Your Name:/home/username:/bin/bash


            and replace bash with zsh:



            username:x:1634231:100:Your Name:/home/username:/bin/zsh


            Log out and log in back for the changes to take effect.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 13 '14 at 22:21









            Georgii OleinikovGeorgii Oleinikov

            29123




            29123








            • 6





              It's better to use chsh, but if you're really going to edit /etc/passwd by hand, at least use the vipw command.

              – Valmiky Arquissandas
              Aug 14 '14 at 2:58











            • I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?

              – Georgii Oleinikov
              Aug 14 '14 at 16:44











            • Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!

              – Andrew
              Sep 12 '17 at 18:23














            • 6





              It's better to use chsh, but if you're really going to edit /etc/passwd by hand, at least use the vipw command.

              – Valmiky Arquissandas
              Aug 14 '14 at 2:58











            • I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?

              – Georgii Oleinikov
              Aug 14 '14 at 16:44











            • Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!

              – Andrew
              Sep 12 '17 at 18:23








            6




            6





            It's better to use chsh, but if you're really going to edit /etc/passwd by hand, at least use the vipw command.

            – Valmiky Arquissandas
            Aug 14 '14 at 2:58





            It's better to use chsh, but if you're really going to edit /etc/passwd by hand, at least use the vipw command.

            – Valmiky Arquissandas
            Aug 14 '14 at 2:58













            I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?

            – Georgii Oleinikov
            Aug 14 '14 at 16:44





            I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening?

            – Georgii Oleinikov
            Aug 14 '14 at 16:44













            Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!

            – Andrew
            Sep 12 '17 at 18:23





            Don't touch /etc/passwd. There are better ways to do this that do not require messing with the passwd tool!

            – Andrew
            Sep 12 '17 at 18:23











            4














            On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...



            To get over this problem, do this:




            • Right click in terminal

            • Profiles -> Profile Preferences

            • Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.

            • Restart Terminal.


            Peace.



            P.S. Don't have 10 reputation to post images, so all texty instructions. :)






            share|improve this answer
























            • You have the rep you need now. :P

              – pradyunsg
              Mar 21 '16 at 8:43
















            4














            On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...



            To get over this problem, do this:




            • Right click in terminal

            • Profiles -> Profile Preferences

            • Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.

            • Restart Terminal.


            Peace.



            P.S. Don't have 10 reputation to post images, so all texty instructions. :)






            share|improve this answer
























            • You have the rep you need now. :P

              – pradyunsg
              Mar 21 '16 at 8:43














            4












            4








            4







            On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...



            To get over this problem, do this:




            • Right click in terminal

            • Profiles -> Profile Preferences

            • Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.

            • Restart Terminal.


            Peace.



            P.S. Don't have 10 reputation to post images, so all texty instructions. :)






            share|improve this answer













            On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...



            To get over this problem, do this:




            • Right click in terminal

            • Profiles -> Profile Preferences

            • Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.

            • Restart Terminal.


            Peace.



            P.S. Don't have 10 reputation to post images, so all texty instructions. :)







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 10 '15 at 3:46









            BenBen

            411




            411













            • You have the rep you need now. :P

              – pradyunsg
              Mar 21 '16 at 8:43



















            • You have the rep you need now. :P

              – pradyunsg
              Mar 21 '16 at 8:43

















            You have the rep you need now. :P

            – pradyunsg
            Mar 21 '16 at 8:43





            You have the rep you need now. :P

            – pradyunsg
            Mar 21 '16 at 8:43











            2














            I came here to just add more additional information.
            If you have troubles when install zsh in Amazon Linux AMI by Amazon, like when you run:



            sudo chsh $(which zsh) : // chsh command not found


            Then you should install util-linux-user:



            sudo yum install util-linux-user


            (by default Amazon Linux AMI only has lchsh, but I can not figure how it work).



            Then run the following command, it should work:



            sudo chsh -s $(which zsh) $(whoami)





            share|improve this answer




























              2














              I came here to just add more additional information.
              If you have troubles when install zsh in Amazon Linux AMI by Amazon, like when you run:



              sudo chsh $(which zsh) : // chsh command not found


              Then you should install util-linux-user:



              sudo yum install util-linux-user


              (by default Amazon Linux AMI only has lchsh, but I can not figure how it work).



              Then run the following command, it should work:



              sudo chsh -s $(which zsh) $(whoami)





              share|improve this answer


























                2












                2








                2







                I came here to just add more additional information.
                If you have troubles when install zsh in Amazon Linux AMI by Amazon, like when you run:



                sudo chsh $(which zsh) : // chsh command not found


                Then you should install util-linux-user:



                sudo yum install util-linux-user


                (by default Amazon Linux AMI only has lchsh, but I can not figure how it work).



                Then run the following command, it should work:



                sudo chsh -s $(which zsh) $(whoami)





                share|improve this answer













                I came here to just add more additional information.
                If you have troubles when install zsh in Amazon Linux AMI by Amazon, like when you run:



                sudo chsh $(which zsh) : // chsh command not found


                Then you should install util-linux-user:



                sudo yum install util-linux-user


                (by default Amazon Linux AMI only has lchsh, but I can not figure how it work).



                Then run the following command, it should work:



                sudo chsh -s $(which zsh) $(whoami)






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 31 '18 at 14:30









                chau giangchau giang

                211




                211






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f231735%2fhow-do-i-change-my-default-shell-on-a-aws-instance%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Plaza Victoria

                    Puebla de Zaragoza

                    Musa