8

Before I ask the question, would someone please help stipulate the Ubuntu definition for these two seemingly identical but different terms (I've given drafts.):

Autologin - When you power up the computer, you sign directly into your account.

Passwordless Login - When you pick a user at the greeter and you are logged in without a prompt for a password.

Now, for the question. How do we change each via the command line? Is the solution the same for all currently supported releases?

And for those who would rather use the gui method, how is that done?

At the bottom of this pic is the checkbox for a passwordless login. It says:

Don't ask for password on login

How do I do this with the command line?

enter image description here

1
  • 1
    Run it with strace then sudo strace -o /tmp/trace -e open users-admin , you can then look in /tmp/trace for the files opened.
    – Panther
    Mar 1, 2012 at 1:10

6 Answers 6

8

I honestly don't know the difference. I'm not sure I've seen the phrase "passwordless login" where I haven't just assumed they're talking about auto-login.

For machines that use LightDM (11.04 up) you can add a user to the configuration in /etc/lightdm/lightdm.conf using the autologin-user variable so the file ends up looking something like this:

[SeatDefaults]
autologin-guest=false
autologin-user=oli
autologin-user-timeout=0
autologin-session=lightdm-autologin
greeter-session=
user-session=ubuntu

That gives you a screen where that user (oli in this case) is logged in automatically after a few seconds. If you want to alter that timeout so it happens more quickly , you can play around with the autologin-user-timeout variable in the same file.

1
  • I used the conf file the gui made for autologin. I deleted it, and then there was no autologin. I copy it to /etc/lightdm in an upstart script and it doesn't make it autologin. Even after a few reboots. Is there a daemon?
    – bambuntu
    Mar 4, 2012 at 17:19
4

Since none of the answers addresses the actual question

How do I do this with the command line? (passwordless login)

I paraphrase from the ArchWiki:

Add the following line to /etc/pam.d/lightdm

auth        sufficient  pam_succeed_if.so user ingroup nopasswdlogin

and create and add yourself to the group nopasswdlogin.

groupadd -r nopasswdlogin
gpasswd -a <username> nopasswdlogin

A systemctl restart lightdm will show the effect. :-)

2
  • 1
    Thank you for directly answering the question. However, this had no effect for me. I still see the login prompt when starting up. It prompts me for a username ("login") and password
    – Adam Grant
    Aug 12, 2017 at 17:54
  • @AdamGrant, same results for me on ubuntu 16.04.1. /var/log/auth.log contains an entry "lightdm: pam_succeed_if(lightdm:auth): requirement "user ingroup nopasswdlogin" was met by user "brian"" but nothing of after that.
    – Brian Cain
    Sep 2, 2017 at 20:55
3

Here is how you can enable passwordless login from Ubuntu 11.10 onward.

  • Go to System SettingsUser Accounts

  • Unlock the administrative functions by clicking the Unlock button in the top right corner and entering your password.

    User Accounts unlock button

  • Select the user for which you want to enable passwordless login.

  • Click on the field/button next to Password.

    User Accounts overview

  • From the Action dropdown list select Log in without a password and click the Change button.

    User Accounts actions

2

Ubuntu 18.04 uses GDM again. Similar to Suuuehgi's answer, this will enable passwordless login, but I don't know if it's safe.

If you want to bypass the password prompt in GDM then simply add the following line on the first line of /etc/pam.d/gdm-password:

auth sufficient pam_succeed_if.so user ingroup nopasswdlogin

Then, add the group nopasswdlogin to your system.

Now, add your user to the nopasswdlogin group and you will only have to click on your username to login.

I don't know if it's safe, because the sufficient control bypasses the other rules that follow, including SELinux session rules, and I don't understand what any of that stuff does.

0

I initially followed the answer from Oli, but the VM complained about running in low-graphics mode. I think Oli turned off/changed a few too many things by clearing greeter-session. In my case, I want the UI to run. To enable this, only required adding two lines to the /etc/lightdm/lightdm.conf file.

   autologin-user=<username>
   autologin-user-timeout=0

so the complete file looks like:

   [SeatDefaults]
   greeter-session=unity-greeter
   user-session=ubuntu
   autologin-user=<username>
   autologin-user-timeout=0

to test your changes without rebooting sudo service lightdm restart

-1

See the answer from Suuuehgi (Enable/Disable Passwordless Login/Autologin Via GUI/Command Line)...

but the following should be at the top, the first line in a pam file (before other auth rules)

auth        sufficient  pam_succeed_if.so user ingroup nopasswdlogin

Btw same works for lightdm as well /etc/pam.d/lightdm .

1
  • 1
    Rather than posting this as a new answer, it might be better to suggest an edit to Suuuehgi's answer to note that the addition must be the first line. That answer refers to lightdm, but Seaside's answer which does mention that the new line has to be at the start refers to gdm - I think the last sentence of your answer refers to Seaside's answer.
    – Zanna
    Jun 1, 2021 at 15:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .