Erik Peña
Uncategorized

Enable Autologin for Headless Kali on Raspberry Pi

I was trying to set up a headless installation of Kali linux on a Raspberry Pi 3 so that I could simply ssh into it from another computer.  One thing that you’ll experience (or are experiencing if you found this post from a search) is that Kali does not allow auto login by default.  In order for you to ssh into your device, you would need to first get past the login screen on the device before ssh becomes available.  Obviously, this does not work for the whole “headless” concept that I am going for.  So in this document, I’ll explain the steps needed to enable autologin on your Kali installation on Raspberry Pi 3.

First step is to enable autologin for lightdmLightdm is the display manager that Kali uses for the UI.  Enabling autologin is done by navigating to the lightdm directory–

# cd /etc/lightdm/

Then opening the configuration file for lightdm.  In this case i’m using nano, but you could use whatever you’re used to–

# nano lightdm.conf

Within the editor of choice scroll to or find the section of the document that looks like this–

#autologin-user=
#autologin-user-timeout=0

We’ll be removing the comment characters (“#”) and setting the autologin user to be “root”.  When you are done, these lines should look like the following–

autologin-user=root
autologin-user-timeout=0

Save and close the file.  Next, we’ll be editing the PAM configuration file for lightdm.  Navigate to the following directory–

# cd /etc/pam.d

Then again using your text editor of choice (again, mine is nano), open the configuration file for edit–

# nano lightdm-autologin

Search through the document (should be close to the top) for the following line–

auth required pam_succeed_if.so user != root quiet_success

We’ll be commenting it out so that PAM doesn’t kick back the autologin request from lightdm.  When you are done, the line should look like the following–

#auth required pam_succeed_if.so user != root quiet_success

Once you have made these changes, save the file and exit the text editor.  Configurations should be in place such that Kali is capable of autologin using the root account.  You can reboot your system to see the changes in effect by typing the following line–

# reboot

Enjoy!

Comments

  1. Thanks.

    FYI, the autologin-user and autologin-user-timeout are present in 2 sections of the file, so you may want to update this to reflect that it’s the second section (under “[Seat:*]” header), because it won’t work if you edit the first occurrence.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.