How do I get Ubuntu to ask me for a password at login again?

I just installed Ubuntu 12.10 and afterwards, I accidentally set the administrator account password to empty/null. This gave me problems when trying to do administrative tasks in the GUI, so after reading up on askubuntu I used the passwd command to set the password for the account anew.

However, at the login screen when clicking on the account, I'm not asked to enter the password; but, instead, I log in directly as if there is no password set for the account.

When doing administrative tasks in the GUI, I will be asked for a password.

What do I do to be asked for the password at login time?

I did already try, several times, in the User Account settings window to set a new password for the account. That is, in the settings window it does not say "login without a password" for my account and it shows that there is a password set for the account.


Run the following command in terminal:

sudo gpasswd -d username nopasswdlogin

substitute your username for username.


I believe all you need to do is go to the "Settings->User Accounts->Unlock->Automatic Login-> Off"

If that doesn't work you can always create a new account and delete your old one. If it is a fresh install this might be the easiest.

You can also manually edit the lightdm configuration file

gksu gedit /etc/lightdm/lightdm.conf

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

Put the pound(number #) symbol in front of all the autologin lines.

One of those has to work. Hope this helps.


None of the other answers worked for me. I'm running Ubuntu 18.04, and I had to go to Settings -> Details -> Users, and then press the "Unlock" button in the top right. Then switch the "Automatic Login" to OFF. And that's it.