How can I make the RPi auto-login when booted, when the GUI is disabled?
You don't have to type a password, when logging in when GUI enabled, so there is probably an easy way of disabling the password prompt in the console.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityHow can I make the RPi auto-login when booted, when the GUI is disabled?
You don't have to type a password, when logging in when GUI enabled, so there is probably an easy way of disabling the password prompt in the console.
For Raspbian Wheezy:
You should be able to edit the /etc/inittab file to enable autologin.
Find a line like this in /etc/inittab
1:2345:respawn:/sbin/getty --noclear 38400 tty1
This starts the getty process on tty1. You can add the getty --autologin
option to that line:
1:2345:respawn:/sbin/getty --autologin {USERNAME} --noclear 38400 tty1
Replace {USERNAME} with the user you want to login.
Note I have not tested this, check the manpage for getty for more details.
Update: Raspbian Jessie uses systemd so inittab is not used. Here is a FAQ that may help for Jessie: https://fedoraproject.org/wiki/Systemd#How_do_I_set_automatic_login_on_a_virtual_console_terminal.3F
The FAQ is for Fedora but it should be very similar on Raspbian Jessie.
UPDATE2: The page above is now gone so here is the content from the Wayback machine:
How do I set automatic login on a virtual console terminal?
First create a new service similar to getty@.service:
# cp /lib/systemd/system/getty@.service \
/etc/systemd/system/autologin@.service
# ln -s /etc/systemd/system/autologin@.service \
/etc/systemd/system/getty.target.wants/getty@tty8.service
then edit ExecStart, Restart and Alias values, like this:
...
ExecStart=-/sbin/mingetty --autologin USERNAME %I
Restart=no
...
Alias=getty.target.wants/getty@tty8.service
and finally reload daemon and start the service:
systemctl daemon-reload
systemctl start getty@tty8.service
Note that if you exit tty8 session, you wont be able to use it until next reboot or manual start by systemctl, except if you leave Restart as ‘always’, but I highly recommend to avoid this according to security reasons.
/etc/inittab
file in raspbian jessie
.
Dec 1, 2015 at 15:39
This worked for me with Jessie Lite:
sudo -i
mkdir -pv /etc/systemd/system/getty@tty1.service.d
nano /etc/systemd/system/getty@tty1.service.d/autologin.conf
contents:
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux
only catch is that I can't logon using SSH anymore - access denied. :-(
ExecStart=-/usr/bin/agetty --autologin username --noclear %I $TERM
lightdm.conf
method didn't work for me. After a bit of playing around the easiest method I found was below.
cd /etc/systemd/system/
From there type: ls
You will see an autologin@.service
just sudo nano autologin@.service
and change line
ExecStart=-/sbin/agetty --autologin pi --noclear % I $TERM
to
ExecStart=-/sbin/agetty --autologin [Username] --noclear % I $TERM
Where [Username] is put the user you wish to login without the brackets.
Now I did have pi auto login working using the raspi-config
setup, but used the above method to change the autologin for a new user.
If you want auto-login to Raspberry Pi on Serial line, you need to edit the /etc/inittab file on pi with sudo permissions.
Find a line like this in /etc/inittab
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
Add the getty --autologin option to that line.
T0:23:respawn:/sbin/getty --autologin {username} -L ttyAMA0 115200 vt100
Save and Reboot.
I'm running NOOBS and had a slightly different inittab file. Here's what I changed that combined both the "--autologin" on the T0 line and the 1:2345 line:
#1:2345:respawn:/sbin/getty --noclear 38400 tty1"
1:2345:respawn:/bin/login -f pi tty1 <dev/tty1 >/dev/tty1 2>&1
T0:23:respawn:/sbin/getty --autologin pi - L ttyAMA0 115200 vt100