lightdm - How to disable automatic login?

18
2014-04
  • iammilind

    I was playing around with "User accounts" and somehow set automatic login. Now, when I start my PC, it just has one button named as "login". Clicking that button, directly logs me in to my PC.

    There is no music or no asking for password while logging in. As a side effect, it asks me separately for keyring password

    How to disable auto login and make login/keyring password unified again like before?

    NOTE: Attempting to disable Automatic Login from System Settings > User Accounts does not work.

    This is the content of my /etc/lightdm/lightdm.conf (where I have commented the autologin for my username mgandhi):

    [SeatDefaults]
    greeter-session=unity-greeter
    user-session=ubuntu
    #autologin-user=mgandhi
    
  • Answers
  • jokerdino
    gksudo gedit /etc/lightdm/lightdm.conf 
    

    It displays some text as follows:

    [SeatDefaults]  
    greeter-session=unity-greeter  
    user-session=ubuntu  
    autologin-user=username
    

    Solution

    1. This <username> would be your particular user name that is automatically logged in with or without password. Delete this username and type in the administrative username or leave it blank.
    2. Shut down the system. It will go back to the login selection screen. Just power down the system and put it on again.
  • jokerdino

    I had the same problem and it was solved by the command:

    sudo gpasswd -d USER nopasswdlogin
    

    where you should change USER by your user name.

  • jokerdino
    gksu gedit /etc/lightdm/lightdm.conf
    

    You should see something similar to this:

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

    Remove or put a # at the start of each line containing autologin and save/exit and reboot to test.

  • One Zero

    System Setings

    enter image description here

    enter image description here

    Disable Automatic Login

  • jokerdino

    Go to your terminal and enter this:

    passwd
    

    It will ask you with your new Unix password and solved.

    Then, later, you can go to your user account and change anything.

  • Anwar Shah

    I am running 12.10 and I tried everything in this thread and nothing worked. Eventually I tried deleting suspicious lines in lightdm.conf and was successful:

    • Run gksu gedit /etc/lightdm/lightdm.conf

    • I can't remember the exact line because I have since deleted it, but it's something like autologin-lightdm=true. Delete it.

    Hope this works!

  • maniat1k

    It's rare that @duffydack answer does not fit you... try this:

    on a terminal do:

    sudo vi /etc/gdm/custom.conf
    

    or

    sudo nano /etc/gdm/custom.conf
    

    Your file should now look something like this:

    [daemon]
    AutomaticLoginEnable=false
    AutomaticLogin=craig
    TimedLoginEnable=false
    TimedLogin=craig
    TimedLoginDelay=10
    DefaultSession=gnome-2d
    

    edit AutomaticLoginEnable=true to AutomaticLoginEnable=false

    that's other option.

  • jokerdino

    Ok, finally the problem is solved. I got an email from an occasional stack-exchange visitor Mr. Rafter. Following is the way:

    • Run sudo grep nopasswd /etc/*
    • This will display at least 2 lines:

      /etc/group:nopasswdlogin:x:112:`<login name>`   
      /etc/gshadow:nopasswdlogin:!::`<login name>`
      
    • Edit those files with sudo and remove only <login name> from those lines and save.

    • Go to "User Accounts" and disable the automatic login
    • Restart the computer and now it should ask for the password again!
  • jokerdino

    Figured out an answer:

    • Boot with Ubuntu live CD.
    • Edit lightdm.conf as root.
    • Comment out (with #) autologon of user.
    • Save and reboot into system.
    • Boot to user login screen, select Ubuntu and enter password.
    • Boot into usual Ubuntu desktop.
  • Jo-Erlend Schinstad

    System Settings > User Accounts. Select your user and disable automatic login.

  • H_7

    Since you was playing around with "User accounts" and I made same mistake, I got in same hole.

    Keep cool.

    You just set your system to no-password when "playing around".

    That's why your system log in (auto or not) without asking for password, and this is the same reason keyring system asks for it (cause doesn't received from the system).

    So, action jackson:

    1. Check what I am talking about. Go to Menu in Top Bar and choose 1st item (Switch User Account...) and see Login button (what mean you already logged and no user to choose, u can just login, u have no pass (OH!)
    2. After clicking Login, and back to desktop, Choose again in top menu bar the logout command, and logout. You gonna see a button with your username, no "login" button.
    3. Correcting things: Setting a new password. Set the same old one, to keyring dont get confused again, or it will ask you for the password again, after login with password provided. Go to same menu of item 1 and choose last item now (User Accounts...) and on this Gui interface , unlock on the respective button probably providing no password at all (just Enter, if this not works try with old pass..), and then THE GREAT MAGIC TRICK

    CLICK THE PASSWORD BOX (its a hidden button, oh devil UI)

    this open a dialog box (!) where u probably hit the "login without password" option AND with automatic login option ON too (outside this dialog, on User Accounts screen). SO:...

    When you tell the computer to log in without a password (ITS NOT the same as Automatic Login) he does exactly this , log in, without password. So password = nothing. Then keyring goes crazy. (aha!) So, choose the right option now:

    Set a password now

    and after doing all the entry password stuff, simple hit enter, set automatic login off, to feel again the pleasure of having a password, and if you want it on again, ok, turn it on, but dont log in without a password again. =D

    I hope this helps you to solve your problem. Was a good lesson to me. Bad UI to Ubuntu -1 on this case.

  • user2234564

    Open the file /etc/group (vi /etc/group) and find the group 'nopasswdlogin'. you will see your user name in that group. comment out that line (inserting # before) or just delete the line.

    This should do it.

  • Seth

    My /etc/lightdm/lightdm.conf was basically empty:

    [SeatDefaults]  
    user-session=
    

    It worked with:

    sudo gpasswd -d USER nopasswdlogin
    

  • Related Question

    lightdm - How do I set the GNOME Classic login to be the default with autologin?
  • 213441265152351

    I changed to gnome classic fallback, I auto-login but it defaults to unity 3d, how do I make auto-login default to gnome classic?


  • Related Answers
  • hhlp

    auto log-in gnome classic desktop :

    • sudo apt-get install gnome-session-fallback
    • sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-classic
  • htorque

    Run the following in a gome-terminal:

    • If you want GNOME Classic with effects:

      sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-classic

    • If you want GNOME Classic without effects:

      sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-fallback