Kali Linux is a Debian-derived Linux distribution designed for digital forensics and penetration testing. It is maintained and funded by Offensive Security Ltd. Mati Aharoni and Devon Kearns of Offensive Security developed it by rewriting BackTrack, their previous forensics Linux distribution.
By default root is the only user account in Kali Linux. It doesn’t present any option to create another user during installation. It however presents an option to set root password during installation. You need root privileges to run pretty much everything in Kali Linux. You can create another non root standard user (See previous post: Add remove user (standard user/non-root) in Kali Linux) for day to day use given that Kali is your Primary Linux distribution but it might get tedious to type in the root password every time you login. This guide will show you how to make a simple few line changes to allow your auto login root user at system start or boot time in both KDE and GNOME Desktop.
Auto login root user at system start in Kali Linux
By default Kali uses gmd3 (GNOME Display Manager). However, you can install KDE and use kdm in Kali Linux. I’ll show both auto login here.
Auto login – GNOME gmd3
Like I said it’s a simple change. Just open and edit the file called /etc/gdm3/daemon.conf, assuming you’re using GNOME Display Manager(gmd3) a your main Display Manager. You might want to try out other desktops as well. Here’s a link to Add/Remove different desktop Managers in Kali Linux.
root@kali:~# leafpad /etc/gdm3/daemon.conf
In the daemon section un-comment the 2 lines for automatic login. It should finally look like this
[daemon] # Enabling automatic login AutomaticLoginEnable = true AutomaticLogin = root
That’s it. Too easy. In case you’re wondering how to use a different user than root, here’s how
[daemon] # Enabling automatic login AutomaticLoginEnable = true AutomaticLogin = myanotheruser
Last but not the least, reboot to check if it worked. (which it will, cause it’s Linux and Kali is awesome)
Enjoy your auto autologin to Kali Linux GNOME gdm3.
Auto login – KDE kdm4
If you managed to install KDE and using KDM instead of GMD, the above process won’t work for you. So we need different instructions to auto login root user in Kali Linux KDE environment. In case you’re wondering how to install KDE, there’s a nice guide on How to Install KDE in Kali Linux.
Again this is a simple process. Edit the file called /etc/kde4/kdm/kdmrc, assuming you’re using KDE Display Manager(kdm4) a your main Display Manager.
root@kali:~# leafpad /etc/kde4/kdm/kdmrc
Add the following lines to the end of this file:
[X-:0-Core] AllowRootLogin=true AutoLoginAgain=true AutoLoginDelay=0 AutoLoginEnable=true AutoLoginLocked=false AutoLoginUser=root ClientLogFile=.xsession-errors
In this example AutoLoginUser specifies which user will auto login into KDE using kdm4. You can change it from root to myanotheruser.
Here’s the catch, you can’t autologin as root in KDE unless you specify AllowRootLogin=true. There’s multiple forums that talks about this, I have yet to find any other solution than outlined here. However, depending on how you’ve setup your KDE, you might already have some of stuffs in the section mentioned above. Just change values to match the code above and you’re all set.
Don’t forget to share with KDE buddies about this.
As always reboot to confirm if auto login root user is working or not.
That’s it for Kali Linux KDE kdm4 auto login .
I can’t say if it’s a good idea to autologin to ANY linux system as root, (or to enable it to start with), but I am hoping you will not do this and leave your system unlocked in open area. I mean how hard it is for someone to come and erase your whole disk and you know what… Too easy. Some might argue to put a different username and then sudo into root account, but then again, it’s really upto the user on what they want to do.
I do this in my VirtualBox, so I can go away for a cup or coffee (cause coffee is absolutely utterly important to run Linux or Kali in general) and when I come back my Vbox is ready and all logged in.
Finally I would like to finish it up with a nice quote from Linus Torvalds
I started Linux as a desktop operating system. And it’s the only area where Linux hasn’t completely taken over. That just annoys the hell out of me.
This is so true about Kali..