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.
-
1Possible? Yeah probably. A terrible, bad, awful, awful, terrible idea? Absolutely.– SammitchFeb 29, 2016 at 23:28
-
3@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.– AlexMar 22, 2017 at 4:20
5 Answers
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.
-
4This 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.– 0x2207Oct 23, 2018 at 18:39
-
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!
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.
-
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review Oct 11, 2021 at 20:56
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
(after the first colon) 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>
-
I updated the link to
passwd
, but to removeroot
password is an extremely bad idea. Sep 14, 2022 at 21:10 -
Niki i agree with you, but i said that, in case someone forgot the Password. in this case, the way will be the same and thanks for updating the link.– djdomiSep 15, 2022 at 8:55
I found this slightly different method worked for me on Debian 10 with GUI disabled:
sudo nano /lib/systemd/system/[email protected]
Change ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I $TERM
to ExecStart=-/sbin/agetty -o '-f -p -- \\u' --noclear -a USERNAME %I $TERM
(replacing USERNAME
with the desired user)