Boot into the GUI after changing default user in raspbian

As usual, when I go looking for something and it takes a while to find, I like to document it here as well. I found some information in this thread “Boot into the GUI after changing default user{.question-hyperlink}” in the Raspberry Pi StackExchange, but I had to modify it quite a lot (including the original post) to reflect the full changes required.

You can manually modify the raspi-config script as follows. Let’s presume we’re using the username “bob”.

sudo vi /usr/bin/raspi-config

Search for the function:

do\_boot\_behaviour() {…}

Under that, there’s a line where we will replace the “-u pi” with “-u bob”, leaving the rest of the line unchanged:

if id -u pi > /dev/null 2>&1; then

Next edit the line:

sed /etc/lightdm/lightdm.conf -i -e "s/^#autologin-user=.*/autologin-user=pi/"

By changing autologin-user=pi to be autologin-user=bob

If you want a pretty menu and also error when it occurs, edit these lines:

whiptail -msgbox "The pi user has been removed, can't set up boot to desktop" 20 60 2


"Desktop" "Log in as user ‘pi' at the graphical desktop" \

Again, replacing “pi” with “bob”, or your username of choice.


#HOWTO #Linux #RaspberryPi #RaspBian