How to login to Ubuntu 18.04 without a password

27,404

I do exactly this myself, and upgraded the box from 16.04 to 18.04 a few weeks ago - with zero ill effects.

Run sudo passwd -d username to delete the password for this user.

That should allow you to login without entering a password, and works fine for me on 18.04

If this is your only account on the machine, you should probably either configure passwordless sudo, or add a second account with administrative privileges.

Share:
27,404

Related videos on Youtube

Phil Lord
Author by

Phil Lord

Occasionally I ask questions on stack exchange

Updated on September 18, 2022

Comments

  • Phil Lord
    Phil Lord over 1 year

    I have just upgraded to Ubuntu 18.04 from 16.04 and I appear to have lost my ability to login without a password. This is something that I used in 16.04 for a media player computer that I have in my living room.

    This question appears to have been asked before, and has been marked as a duplicated here:

    How can I log in to Ubuntu 18.04 without a password? Setting auto login doesn't work

    However, the answers are about auto-login and I do not want this. I want to get a login dialog with a user name that requires no password, not one that auto-logins in on boot. This is so that I can choose which account to login in to (I have one account for playing media and my own "real" account which I use for sys admin), or so that I can choose session types (my media account mostly uses kodi, but sometimes I need a desktop).

    This was possible with previous versions of Ubuntu:

    http://ubuntuhandbook.org/index.php/2013/07/login-without-a-password-on-ubuntu/

    Has it been lost in 18.04?

  • Phil Lord
    Phil Lord over 5 years
    Yes, I guess this will be the way to go, although I was a bit wary of this because it will effect all authentication, including over a network. I guess the risk are relatively low for a media box, but still.
  • vidarlo
    vidarlo over 5 years
    By default ssh disallows login with empty password, so it's only accessible on the local console. You can verify that PermitEmptyPasswords is set to no in /etc/ssh/sshd_config.
  • Phil Lord
    Phil Lord over 5 years
    Yes, I did this for ssh.
  • Phil Lord
    Phil Lord over 5 years
    Once you have done this, though, there doesn't appear to be anyway to change the session (from gnome->kodi, or kodi->gnome), since the option to do this is at the password dialog which no longer appears (as soon as you click on the user, you login, not as previously requiring another click).
  • Cosmologicon
    Cosmologicon over 4 years
    Am I doing it wrong? >>> ~$ sudo useradd testpasswd >>> ~$ sudo passwd -d testpasswd >>> passwd: password expiry information changed. >>> ~$ su testpasswd >>> Password: [press Enter] >>> su: Authentication failure
  • vidarlo
    vidarlo over 4 years
    @Cosmologicon try to login as that user, not su to it.
  • John Dee
    John Dee about 4 years
    This destroyed my machine. I installed Ubuntu onto MacBook Pro, issued the command. Now I can't execute ANY sudo commands because every time I try one, it asks me for a password, which is now disabled. DON'T DO THIS IF YOU ONLY HAVE ONE ACCOUNT ON THE MACHINE.
  • vidarlo
    vidarlo about 4 years
    @JohnDee It didn't destroy your machine; it's rather trivial to fix. But it's a good point, and I'll include it in my answer.
  • Gopipuli
    Gopipuli over 3 years
    I think this can be done by enabling autologing in user setting. For me it worked not changed any conf settings.