How to change root's shell back to bash?











up vote
5
down vote

favorite
2












I tried to change root's shell with chsh command, but now I get an error when I try to connect as root with sudo -i.



$ sudo -i
sudo: /usr/bin/bash: command not found


What do I have to modify to get the bash shell?










share|improve this question




























    up vote
    5
    down vote

    favorite
    2












    I tried to change root's shell with chsh command, but now I get an error when I try to connect as root with sudo -i.



    $ sudo -i
    sudo: /usr/bin/bash: command not found


    What do I have to modify to get the bash shell?










    share|improve this question


























      up vote
      5
      down vote

      favorite
      2









      up vote
      5
      down vote

      favorite
      2






      2





      I tried to change root's shell with chsh command, but now I get an error when I try to connect as root with sudo -i.



      $ sudo -i
      sudo: /usr/bin/bash: command not found


      What do I have to modify to get the bash shell?










      share|improve this question















      I tried to change root's shell with chsh command, but now I get an error when I try to connect as root with sudo -i.



      $ sudo -i
      sudo: /usr/bin/bash: command not found


      What do I have to modify to get the bash shell?







      command-line bash root chsh






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 at 21:14









      wjandrea

      7,70642258




      7,70642258










      asked Nov 30 '16 at 3:28









      Sandra Ross

      3422416




      3422416






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          12
          down vote



          accepted










          Assuming that you have not modified the path or created symlink, the default path to the bash binary is /bin/bash, not /usr/bin/bash.



          The error is occurring because you have set the root's shell as /usr/bin/bash in /etc/passwd like:



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


          You need to change that to /bin/bash:



          sudo usermod -s /bin/bash root


          or do:



          sudo vipw


          and make the modifications manually.



          You can obviously choose any other shell of your choice, just make sure that the path is correct. A common place to look for shell paths is /etc/shells file which contains the full paths to all the valid login shells on the system.






          share|improve this answer























          • Thanks for your answer. In the same time, I noticed I could modify the path with sudo emacs /etc/passwd
            – Sandra Ross
            Nov 30 '16 at 3:40






          • 4




            @SandraRoss If you are confident you can obviously do that. But i would suggest vipw as it will do the sanity checkings (e.g. syntax) over the changes to make sure everything is in place.
            – heemayl
            Nov 30 '16 at 3:43






          • 1




            If you don't want to usse vipw, you can check the integrity of /etc/passwd with pwck
            – ohno
            Nov 30 '16 at 9:00











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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',
          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%2faskubuntu.com%2fquestions%2f855211%2fhow-to-change-roots-shell-back-to-bash%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          12
          down vote



          accepted










          Assuming that you have not modified the path or created symlink, the default path to the bash binary is /bin/bash, not /usr/bin/bash.



          The error is occurring because you have set the root's shell as /usr/bin/bash in /etc/passwd like:



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


          You need to change that to /bin/bash:



          sudo usermod -s /bin/bash root


          or do:



          sudo vipw


          and make the modifications manually.



          You can obviously choose any other shell of your choice, just make sure that the path is correct. A common place to look for shell paths is /etc/shells file which contains the full paths to all the valid login shells on the system.






          share|improve this answer























          • Thanks for your answer. In the same time, I noticed I could modify the path with sudo emacs /etc/passwd
            – Sandra Ross
            Nov 30 '16 at 3:40






          • 4




            @SandraRoss If you are confident you can obviously do that. But i would suggest vipw as it will do the sanity checkings (e.g. syntax) over the changes to make sure everything is in place.
            – heemayl
            Nov 30 '16 at 3:43






          • 1




            If you don't want to usse vipw, you can check the integrity of /etc/passwd with pwck
            – ohno
            Nov 30 '16 at 9:00















          up vote
          12
          down vote



          accepted










          Assuming that you have not modified the path or created symlink, the default path to the bash binary is /bin/bash, not /usr/bin/bash.



          The error is occurring because you have set the root's shell as /usr/bin/bash in /etc/passwd like:



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


          You need to change that to /bin/bash:



          sudo usermod -s /bin/bash root


          or do:



          sudo vipw


          and make the modifications manually.



          You can obviously choose any other shell of your choice, just make sure that the path is correct. A common place to look for shell paths is /etc/shells file which contains the full paths to all the valid login shells on the system.






          share|improve this answer























          • Thanks for your answer. In the same time, I noticed I could modify the path with sudo emacs /etc/passwd
            – Sandra Ross
            Nov 30 '16 at 3:40






          • 4




            @SandraRoss If you are confident you can obviously do that. But i would suggest vipw as it will do the sanity checkings (e.g. syntax) over the changes to make sure everything is in place.
            – heemayl
            Nov 30 '16 at 3:43






          • 1




            If you don't want to usse vipw, you can check the integrity of /etc/passwd with pwck
            – ohno
            Nov 30 '16 at 9:00













          up vote
          12
          down vote



          accepted







          up vote
          12
          down vote



          accepted






          Assuming that you have not modified the path or created symlink, the default path to the bash binary is /bin/bash, not /usr/bin/bash.



          The error is occurring because you have set the root's shell as /usr/bin/bash in /etc/passwd like:



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


          You need to change that to /bin/bash:



          sudo usermod -s /bin/bash root


          or do:



          sudo vipw


          and make the modifications manually.



          You can obviously choose any other shell of your choice, just make sure that the path is correct. A common place to look for shell paths is /etc/shells file which contains the full paths to all the valid login shells on the system.






          share|improve this answer














          Assuming that you have not modified the path or created symlink, the default path to the bash binary is /bin/bash, not /usr/bin/bash.



          The error is occurring because you have set the root's shell as /usr/bin/bash in /etc/passwd like:



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


          You need to change that to /bin/bash:



          sudo usermod -s /bin/bash root


          or do:



          sudo vipw


          and make the modifications manually.



          You can obviously choose any other shell of your choice, just make sure that the path is correct. A common place to look for shell paths is /etc/shells file which contains the full paths to all the valid login shells on the system.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 2 '16 at 2:32









          wjandrea

          7,70642258




          7,70642258










          answered Nov 30 '16 at 3:36









          heemayl

          65.2k8134208




          65.2k8134208












          • Thanks for your answer. In the same time, I noticed I could modify the path with sudo emacs /etc/passwd
            – Sandra Ross
            Nov 30 '16 at 3:40






          • 4




            @SandraRoss If you are confident you can obviously do that. But i would suggest vipw as it will do the sanity checkings (e.g. syntax) over the changes to make sure everything is in place.
            – heemayl
            Nov 30 '16 at 3:43






          • 1




            If you don't want to usse vipw, you can check the integrity of /etc/passwd with pwck
            – ohno
            Nov 30 '16 at 9:00


















          • Thanks for your answer. In the same time, I noticed I could modify the path with sudo emacs /etc/passwd
            – Sandra Ross
            Nov 30 '16 at 3:40






          • 4




            @SandraRoss If you are confident you can obviously do that. But i would suggest vipw as it will do the sanity checkings (e.g. syntax) over the changes to make sure everything is in place.
            – heemayl
            Nov 30 '16 at 3:43






          • 1




            If you don't want to usse vipw, you can check the integrity of /etc/passwd with pwck
            – ohno
            Nov 30 '16 at 9:00
















          Thanks for your answer. In the same time, I noticed I could modify the path with sudo emacs /etc/passwd
          – Sandra Ross
          Nov 30 '16 at 3:40




          Thanks for your answer. In the same time, I noticed I could modify the path with sudo emacs /etc/passwd
          – Sandra Ross
          Nov 30 '16 at 3:40




          4




          4




          @SandraRoss If you are confident you can obviously do that. But i would suggest vipw as it will do the sanity checkings (e.g. syntax) over the changes to make sure everything is in place.
          – heemayl
          Nov 30 '16 at 3:43




          @SandraRoss If you are confident you can obviously do that. But i would suggest vipw as it will do the sanity checkings (e.g. syntax) over the changes to make sure everything is in place.
          – heemayl
          Nov 30 '16 at 3:43




          1




          1




          If you don't want to usse vipw, you can check the integrity of /etc/passwd with pwck
          – ohno
          Nov 30 '16 at 9:00




          If you don't want to usse vipw, you can check the integrity of /etc/passwd with pwck
          – ohno
          Nov 30 '16 at 9:00


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f855211%2fhow-to-change-roots-shell-back-to-bash%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

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents