Sunday, July 15, 2012

Disable / Enable Passwordless Login, all Ubuntus

Aside from the common, and way less detrimental, option to auto-login to your desktop, you may easily be tempted to think that logging in without password query is a good idea - well, it is not, as you may have learned already. It's only useful under very narrow, unusual conditions, otherwise it will either not let you change the desktop session option anymore, or lock you out of your desktop completely. This is how to re-enable the password query on login, or if all conditions are actually met, how to disable it.

Re-enable Password Query

For the above-mentioned reasons, passwordless login is not enabled by default. But you may have either chosen that on installation, or enabled it afterwards, the latter either via GUI, if an option is available there, or via command line. Eventually, you may find yourself unable to disable it again, either because there is no option available in the GUI, or because you cannot log in to your desktop anymore in the first place. So, to disable the passwordless login from the command line, either in a Terminal or at the CLI/tty, just run this command:

sudo gpasswd -d <USERNAME> nopasswdlogin

Notes: Technically, that removes the concerning user from the group "nopasswdlogin". Replace <USERNAME> with the respective actual username, obviously.

Disable Password Query

The only case where passwordless login would be needed, at least if using LightDM as of now (because of this bug, is if there are multiple users using the same system, and the concerning user/s don't want to enter their password/s each time on login. If that's the case, make sure that at least all these conditions are also met: The concerning user/s ...
  • are fine with anyone using the system having complete access to their account (same as with auto-login),
  • don't have an encrypted home directory (would lock them out of their desktop completely!),
  • don't ever want to change the desktop session option the log in to (at least not in an easy way),
  • are fine with possible keyring password queries after login (same as with auto-login).
So, if all the above-mentioned conditions are actually met, and you really want to enable passwordless login, with a possible absence of a GUI option for that, run this command either in a Terminal or at the CLI/tty:

sudo usermod -a -G nopasswdlogin <USERNAME>

Notes: Technically, that adds the concerning user to the group "nopasswdlogin". Replace <USERNAME> with the respective actual username, obviously.

Related Posts: