How can I get autologin at startup working on Ubuntu Server 16.04.1?











up vote
5
down vote

favorite
3












I have a problem with autologin at startup in Ubuntu Server 16.04.1 LTS.



I use this server only for listening internet radio so I do not care about security.



I was able to create a bash script to auto start mplayer but can't configure autologin.



I've tried at least 4 solutions (always editing the file /etc/init/tty1.conf and of course replacing USERNAME with actual user name):





  1. change the line from



    exec /sbin/getty -8 38400 tty1


    to



    exec /sbin/getty -8 38400 tty1 -a USERNAME 



  2. change the line from



    exec /sbin/getty -8 38400 tty1


    to



    exec /bin/login -f USERNAME < /dev/tty1 > /dev/tty1 2>&1



  3. Install rungetty, comment the line



    exec /sbin/getty -8 38400 tty1


    and add the line



    exec /sbin/rungetty --autologin USERNAME tty1 



  4. Install mingetty, comment the line



    exec /sbin/getty -8 38400 tty1


    and add the line



    exec /sbin/mingetty --autologin USERNAME tty1



Nothing helps - I have to input my login and password at startup - any ideas what to do?










share|improve this question




























    up vote
    5
    down vote

    favorite
    3












    I have a problem with autologin at startup in Ubuntu Server 16.04.1 LTS.



    I use this server only for listening internet radio so I do not care about security.



    I was able to create a bash script to auto start mplayer but can't configure autologin.



    I've tried at least 4 solutions (always editing the file /etc/init/tty1.conf and of course replacing USERNAME with actual user name):





    1. change the line from



      exec /sbin/getty -8 38400 tty1


      to



      exec /sbin/getty -8 38400 tty1 -a USERNAME 



    2. change the line from



      exec /sbin/getty -8 38400 tty1


      to



      exec /bin/login -f USERNAME < /dev/tty1 > /dev/tty1 2>&1



    3. Install rungetty, comment the line



      exec /sbin/getty -8 38400 tty1


      and add the line



      exec /sbin/rungetty --autologin USERNAME tty1 



    4. Install mingetty, comment the line



      exec /sbin/getty -8 38400 tty1


      and add the line



      exec /sbin/mingetty --autologin USERNAME tty1



    Nothing helps - I have to input my login and password at startup - any ideas what to do?










    share|improve this question


























      up vote
      5
      down vote

      favorite
      3









      up vote
      5
      down vote

      favorite
      3






      3





      I have a problem with autologin at startup in Ubuntu Server 16.04.1 LTS.



      I use this server only for listening internet radio so I do not care about security.



      I was able to create a bash script to auto start mplayer but can't configure autologin.



      I've tried at least 4 solutions (always editing the file /etc/init/tty1.conf and of course replacing USERNAME with actual user name):





      1. change the line from



        exec /sbin/getty -8 38400 tty1


        to



        exec /sbin/getty -8 38400 tty1 -a USERNAME 



      2. change the line from



        exec /sbin/getty -8 38400 tty1


        to



        exec /bin/login -f USERNAME < /dev/tty1 > /dev/tty1 2>&1



      3. Install rungetty, comment the line



        exec /sbin/getty -8 38400 tty1


        and add the line



        exec /sbin/rungetty --autologin USERNAME tty1 



      4. Install mingetty, comment the line



        exec /sbin/getty -8 38400 tty1


        and add the line



        exec /sbin/mingetty --autologin USERNAME tty1



      Nothing helps - I have to input my login and password at startup - any ideas what to do?










      share|improve this question















      I have a problem with autologin at startup in Ubuntu Server 16.04.1 LTS.



      I use this server only for listening internet radio so I do not care about security.



      I was able to create a bash script to auto start mplayer but can't configure autologin.



      I've tried at least 4 solutions (always editing the file /etc/init/tty1.conf and of course replacing USERNAME with actual user name):





      1. change the line from



        exec /sbin/getty -8 38400 tty1


        to



        exec /sbin/getty -8 38400 tty1 -a USERNAME 



      2. change the line from



        exec /sbin/getty -8 38400 tty1


        to



        exec /bin/login -f USERNAME < /dev/tty1 > /dev/tty1 2>&1



      3. Install rungetty, comment the line



        exec /sbin/getty -8 38400 tty1


        and add the line



        exec /sbin/rungetty --autologin USERNAME tty1 



      4. Install mingetty, comment the line



        exec /sbin/getty -8 38400 tty1


        and add the line



        exec /sbin/mingetty --autologin USERNAME tty1



      Nothing helps - I have to input my login and password at startup - any ideas what to do?







      command-line login startup






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 25 at 16:35









      Zanna

      49.4k13127236




      49.4k13127236










      asked Aug 31 '16 at 12:10









      Tomek

      28115




      28115






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          18
          down vote



          accepted










          Try this:



          Create the folder /etc/systemd/system/getty@tty1.service.d



          Create the file /etc/systemd/system/getty@tty1.service.d/override.conf



          Open the file with your favorite editor and add this:



          [Service]
          ExecStart=
          ExecStart=-/sbin/agetty --noissue --autologin myusername %I $TERM
          Type=idle


          Replace myusername with your user name.






          share|improve this answer























          • I followed your guide and my machine can log in automatically now. BUT I cannot ssh to the machine as possible before. Please help me to get back to my SSH connection.
            – Nam G VU
            Feb 10 '17 at 10:04










          • Hi Nam. Your user have a password? I tried this in a machine and i can access to it over SSH with the user passwd. Shows any error? Thanks.
            – Jose Carlos Nieto Ramos
            Mar 3 '17 at 18:46










          • Too long ago and the machine is deleted on my side; sorry I can't get you the error. User has a password of course.
            – Nam G VU
            Mar 4 '17 at 11:21










          • Your guide took me stuck at [OK] Started Update UTMP about System Runlevel Changes. during boot
            – Patrizio Bertoni
            Sep 19 '17 at 8:46










          • Instead of manually creating the .d directory and the override.conf file we can also simply say sudo systemctl edit getty@tty1.service. It will the create the file (if neccessary) and open it an editor. Simply save the file under the suggested name when finished.
            – PerlDuck
            Jul 25 at 11:23


















          up vote
          1
          down vote













          agetty opens a tty port, prompts for a login name and invokes the /bin/login command.



          This file overrides the config by default of agetty on systemd for tty1. This provides a new instance of tty1 with autologin for the user specified.



          By the way, the parameter --noissue is used to hide the contents of /etc/issue on login, so not needed in your case.



          The option Type=idle found in the default getty@.service will delay the service startup until all jobs are completed in order to avoid polluting the login prompt with boot-up messages. When starting X automatically, it may be useful to start getty@tty1.service immediately by adding Type=simple into the file.



          More info: getty: Archlinux.org






          share|improve this answer



















          • 1




            Once again - thank you very much for explanations - they are very deep and clear. Some more information about autologin here: askubuntu.com/questions/771837/… and about overriding here: askubuntu.com/questions/659267/…
            – Tomek
            Aug 31 '16 at 15:48











          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%2f819117%2fhow-can-i-get-autologin-at-startup-working-on-ubuntu-server-16-04-1%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          18
          down vote



          accepted










          Try this:



          Create the folder /etc/systemd/system/getty@tty1.service.d



          Create the file /etc/systemd/system/getty@tty1.service.d/override.conf



          Open the file with your favorite editor and add this:



          [Service]
          ExecStart=
          ExecStart=-/sbin/agetty --noissue --autologin myusername %I $TERM
          Type=idle


          Replace myusername with your user name.






          share|improve this answer























          • I followed your guide and my machine can log in automatically now. BUT I cannot ssh to the machine as possible before. Please help me to get back to my SSH connection.
            – Nam G VU
            Feb 10 '17 at 10:04










          • Hi Nam. Your user have a password? I tried this in a machine and i can access to it over SSH with the user passwd. Shows any error? Thanks.
            – Jose Carlos Nieto Ramos
            Mar 3 '17 at 18:46










          • Too long ago and the machine is deleted on my side; sorry I can't get you the error. User has a password of course.
            – Nam G VU
            Mar 4 '17 at 11:21










          • Your guide took me stuck at [OK] Started Update UTMP about System Runlevel Changes. during boot
            – Patrizio Bertoni
            Sep 19 '17 at 8:46










          • Instead of manually creating the .d directory and the override.conf file we can also simply say sudo systemctl edit getty@tty1.service. It will the create the file (if neccessary) and open it an editor. Simply save the file under the suggested name when finished.
            – PerlDuck
            Jul 25 at 11:23















          up vote
          18
          down vote



          accepted










          Try this:



          Create the folder /etc/systemd/system/getty@tty1.service.d



          Create the file /etc/systemd/system/getty@tty1.service.d/override.conf



          Open the file with your favorite editor and add this:



          [Service]
          ExecStart=
          ExecStart=-/sbin/agetty --noissue --autologin myusername %I $TERM
          Type=idle


          Replace myusername with your user name.






          share|improve this answer























          • I followed your guide and my machine can log in automatically now. BUT I cannot ssh to the machine as possible before. Please help me to get back to my SSH connection.
            – Nam G VU
            Feb 10 '17 at 10:04










          • Hi Nam. Your user have a password? I tried this in a machine and i can access to it over SSH with the user passwd. Shows any error? Thanks.
            – Jose Carlos Nieto Ramos
            Mar 3 '17 at 18:46










          • Too long ago and the machine is deleted on my side; sorry I can't get you the error. User has a password of course.
            – Nam G VU
            Mar 4 '17 at 11:21










          • Your guide took me stuck at [OK] Started Update UTMP about System Runlevel Changes. during boot
            – Patrizio Bertoni
            Sep 19 '17 at 8:46










          • Instead of manually creating the .d directory and the override.conf file we can also simply say sudo systemctl edit getty@tty1.service. It will the create the file (if neccessary) and open it an editor. Simply save the file under the suggested name when finished.
            – PerlDuck
            Jul 25 at 11:23













          up vote
          18
          down vote



          accepted







          up vote
          18
          down vote



          accepted






          Try this:



          Create the folder /etc/systemd/system/getty@tty1.service.d



          Create the file /etc/systemd/system/getty@tty1.service.d/override.conf



          Open the file with your favorite editor and add this:



          [Service]
          ExecStart=
          ExecStart=-/sbin/agetty --noissue --autologin myusername %I $TERM
          Type=idle


          Replace myusername with your user name.






          share|improve this answer














          Try this:



          Create the folder /etc/systemd/system/getty@tty1.service.d



          Create the file /etc/systemd/system/getty@tty1.service.d/override.conf



          Open the file with your favorite editor and add this:



          [Service]
          ExecStart=
          ExecStart=-/sbin/agetty --noissue --autologin myusername %I $TERM
          Type=idle


          Replace myusername with your user name.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 25 at 16:36









          Zanna

          49.4k13127236




          49.4k13127236










          answered Aug 31 '16 at 13:17









          Jose Carlos Nieto Ramos

          30625




          30625












          • I followed your guide and my machine can log in automatically now. BUT I cannot ssh to the machine as possible before. Please help me to get back to my SSH connection.
            – Nam G VU
            Feb 10 '17 at 10:04










          • Hi Nam. Your user have a password? I tried this in a machine and i can access to it over SSH with the user passwd. Shows any error? Thanks.
            – Jose Carlos Nieto Ramos
            Mar 3 '17 at 18:46










          • Too long ago and the machine is deleted on my side; sorry I can't get you the error. User has a password of course.
            – Nam G VU
            Mar 4 '17 at 11:21










          • Your guide took me stuck at [OK] Started Update UTMP about System Runlevel Changes. during boot
            – Patrizio Bertoni
            Sep 19 '17 at 8:46










          • Instead of manually creating the .d directory and the override.conf file we can also simply say sudo systemctl edit getty@tty1.service. It will the create the file (if neccessary) and open it an editor. Simply save the file under the suggested name when finished.
            – PerlDuck
            Jul 25 at 11:23


















          • I followed your guide and my machine can log in automatically now. BUT I cannot ssh to the machine as possible before. Please help me to get back to my SSH connection.
            – Nam G VU
            Feb 10 '17 at 10:04










          • Hi Nam. Your user have a password? I tried this in a machine and i can access to it over SSH with the user passwd. Shows any error? Thanks.
            – Jose Carlos Nieto Ramos
            Mar 3 '17 at 18:46










          • Too long ago and the machine is deleted on my side; sorry I can't get you the error. User has a password of course.
            – Nam G VU
            Mar 4 '17 at 11:21










          • Your guide took me stuck at [OK] Started Update UTMP about System Runlevel Changes. during boot
            – Patrizio Bertoni
            Sep 19 '17 at 8:46










          • Instead of manually creating the .d directory and the override.conf file we can also simply say sudo systemctl edit getty@tty1.service. It will the create the file (if neccessary) and open it an editor. Simply save the file under the suggested name when finished.
            – PerlDuck
            Jul 25 at 11:23
















          I followed your guide and my machine can log in automatically now. BUT I cannot ssh to the machine as possible before. Please help me to get back to my SSH connection.
          – Nam G VU
          Feb 10 '17 at 10:04




          I followed your guide and my machine can log in automatically now. BUT I cannot ssh to the machine as possible before. Please help me to get back to my SSH connection.
          – Nam G VU
          Feb 10 '17 at 10:04












          Hi Nam. Your user have a password? I tried this in a machine and i can access to it over SSH with the user passwd. Shows any error? Thanks.
          – Jose Carlos Nieto Ramos
          Mar 3 '17 at 18:46




          Hi Nam. Your user have a password? I tried this in a machine and i can access to it over SSH with the user passwd. Shows any error? Thanks.
          – Jose Carlos Nieto Ramos
          Mar 3 '17 at 18:46












          Too long ago and the machine is deleted on my side; sorry I can't get you the error. User has a password of course.
          – Nam G VU
          Mar 4 '17 at 11:21




          Too long ago and the machine is deleted on my side; sorry I can't get you the error. User has a password of course.
          – Nam G VU
          Mar 4 '17 at 11:21












          Your guide took me stuck at [OK] Started Update UTMP about System Runlevel Changes. during boot
          – Patrizio Bertoni
          Sep 19 '17 at 8:46




          Your guide took me stuck at [OK] Started Update UTMP about System Runlevel Changes. during boot
          – Patrizio Bertoni
          Sep 19 '17 at 8:46












          Instead of manually creating the .d directory and the override.conf file we can also simply say sudo systemctl edit getty@tty1.service. It will the create the file (if neccessary) and open it an editor. Simply save the file under the suggested name when finished.
          – PerlDuck
          Jul 25 at 11:23




          Instead of manually creating the .d directory and the override.conf file we can also simply say sudo systemctl edit getty@tty1.service. It will the create the file (if neccessary) and open it an editor. Simply save the file under the suggested name when finished.
          – PerlDuck
          Jul 25 at 11:23












          up vote
          1
          down vote













          agetty opens a tty port, prompts for a login name and invokes the /bin/login command.



          This file overrides the config by default of agetty on systemd for tty1. This provides a new instance of tty1 with autologin for the user specified.



          By the way, the parameter --noissue is used to hide the contents of /etc/issue on login, so not needed in your case.



          The option Type=idle found in the default getty@.service will delay the service startup until all jobs are completed in order to avoid polluting the login prompt with boot-up messages. When starting X automatically, it may be useful to start getty@tty1.service immediately by adding Type=simple into the file.



          More info: getty: Archlinux.org






          share|improve this answer



















          • 1




            Once again - thank you very much for explanations - they are very deep and clear. Some more information about autologin here: askubuntu.com/questions/771837/… and about overriding here: askubuntu.com/questions/659267/…
            – Tomek
            Aug 31 '16 at 15:48















          up vote
          1
          down vote













          agetty opens a tty port, prompts for a login name and invokes the /bin/login command.



          This file overrides the config by default of agetty on systemd for tty1. This provides a new instance of tty1 with autologin for the user specified.



          By the way, the parameter --noissue is used to hide the contents of /etc/issue on login, so not needed in your case.



          The option Type=idle found in the default getty@.service will delay the service startup until all jobs are completed in order to avoid polluting the login prompt with boot-up messages. When starting X automatically, it may be useful to start getty@tty1.service immediately by adding Type=simple into the file.



          More info: getty: Archlinux.org






          share|improve this answer



















          • 1




            Once again - thank you very much for explanations - they are very deep and clear. Some more information about autologin here: askubuntu.com/questions/771837/… and about overriding here: askubuntu.com/questions/659267/…
            – Tomek
            Aug 31 '16 at 15:48













          up vote
          1
          down vote










          up vote
          1
          down vote









          agetty opens a tty port, prompts for a login name and invokes the /bin/login command.



          This file overrides the config by default of agetty on systemd for tty1. This provides a new instance of tty1 with autologin for the user specified.



          By the way, the parameter --noissue is used to hide the contents of /etc/issue on login, so not needed in your case.



          The option Type=idle found in the default getty@.service will delay the service startup until all jobs are completed in order to avoid polluting the login prompt with boot-up messages. When starting X automatically, it may be useful to start getty@tty1.service immediately by adding Type=simple into the file.



          More info: getty: Archlinux.org






          share|improve this answer














          agetty opens a tty port, prompts for a login name and invokes the /bin/login command.



          This file overrides the config by default of agetty on systemd for tty1. This provides a new instance of tty1 with autologin for the user specified.



          By the way, the parameter --noissue is used to hide the contents of /etc/issue on login, so not needed in your case.



          The option Type=idle found in the default getty@.service will delay the service startup until all jobs are completed in order to avoid polluting the login prompt with boot-up messages. When starting X automatically, it may be useful to start getty@tty1.service immediately by adding Type=simple into the file.



          More info: getty: Archlinux.org







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 25 at 16:37









          Zanna

          49.4k13127236




          49.4k13127236










          answered Aug 31 '16 at 14:38









          Jose Carlos Nieto Ramos

          30625




          30625








          • 1




            Once again - thank you very much for explanations - they are very deep and clear. Some more information about autologin here: askubuntu.com/questions/771837/… and about overriding here: askubuntu.com/questions/659267/…
            – Tomek
            Aug 31 '16 at 15:48














          • 1




            Once again - thank you very much for explanations - they are very deep and clear. Some more information about autologin here: askubuntu.com/questions/771837/… and about overriding here: askubuntu.com/questions/659267/…
            – Tomek
            Aug 31 '16 at 15:48








          1




          1




          Once again - thank you very much for explanations - they are very deep and clear. Some more information about autologin here: askubuntu.com/questions/771837/… and about overriding here: askubuntu.com/questions/659267/…
          – Tomek
          Aug 31 '16 at 15:48




          Once again - thank you very much for explanations - they are very deep and clear. Some more information about autologin here: askubuntu.com/questions/771837/… and about overriding here: askubuntu.com/questions/659267/…
          – Tomek
          Aug 31 '16 at 15:48


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


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





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2faskubuntu.com%2fquestions%2f819117%2fhow-can-i-get-autologin-at-startup-working-on-ubuntu-server-16-04-1%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

          Quarter-circle Tiles

          build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

          Mont Emei