5

I want to allow a user that is logging in to the system locally (ie. keyboard & mouse) to not have to enter a password. Is this possible? I have the system locked down extremely well with SSH, and it sits with me always, so I it is not an issue.

2
  • 1
    Possible? Yeah probably. A terrible, bad, awful, awful, terrible idea? Absolutely.
    – Sammitch
    Feb 29 '16 at 23:28
  • 2
    @Sammitch, on an embedded development system (pre-release), that you are actively developing, where every time you boot, you want to save a few seconds not having to deal with the password of the user account, I think this is an absolutely fantastic idea that should deserve a gold medal. OPs question is helping me find a solution. I'm happy he asked so I don't have to ask myself. I too find his reasoning somewhat naive.
    – Alex
    Mar 22 '17 at 4:20
3

This may be bad security but as noted if you have physical access to a non encrypted laptop you could get into the files and reset passwords with a linux live cd/usb or sometimes the grub menu lets you boot to recovery root and you can change the password.

Do you mean a virtual console or the default graphical console?

Login Settings (GNOME/KDE) should have option to boot to desktop without password.

For Virtaul Consoles

Arch linux has a guide which I think should work for other systemd distros.

https://wiki.archlinux.org/index.php/Automatic_login_to_virtual_console

run

systemctl edit getty@tty1

and put the following into the file

[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin username --noclear %I $TERM

I think that should let you autologin to the first console.

2
  • 2
    This doesn't work for me. It says 'root (automatic login)' but then It still asks for password. Probably, something should be tuned in PAM configuration.
    – 0x2207
    Oct 23 '18 at 18:39
  • I have the same issue, @0x2207 !!
    – Osqui
    Mar 22 '19 at 17:48
2

Following from the great information from @Roman I modified his answer somewhat for the solution on my system, which was Debian. For anyone else needing this; for Debian, edit /etc/systemd/system/getty.target.wants/getty\@tty1.service and add --autologin root to the line which begins with ExecStart=- so that it reads:

ExecStart=-/sbin/agetty --autologin root --noclear %I $TERM

Hope that helps. I realize it is a security risk in most cases. But when it is an embedded router that is strapped to the bottom of my desk and all external authentication is done with 2 factor authentication... I am not too worried.

Thank you for the help @Roman!

0

I did not manage to get agetty to automatically login regular user without a password. It still requires it. But as I am running standalone workstation without internet connection for my purpose, I found that just clearing the user's password does the trick. Now autologin works. Hope this was better documented in agetty's manpage.

1
0

1. - The Lazy Edit on /etc/passwd

change the X from

radvd:x:109:65534::/run/radvd:/usr/sbin/nologin
to
radvd::109:65534::/run/radvd:/usr/sbin/nologin

and the Password has gone, this works also in case you lost the root password

Using the "Official Way" with passwd command

passwd -d <user>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.