How To Login As Root On Kali Linux? (GUI & SSH)

On Kali Linux, as well as on most Debian-based Linux distributions, the administrator user (root) is no longer available by default. In this tutorial, I’ll explain why it’s like that, and how you can enable it if needed.

On Kali Linux, administrator privileges can be used temporarily by using the “sudo” command with an authorized user, instead of logging on as root. There is still a way to enable “root” if necessary, but it’s not recommended for security reasons.

Let me take a few seconds to explain why it’s like that, and then I’ll tell you everything you can do about it.

Master Linux Commands
Your essential Linux handbook
Want to level up your Linux skills? Here is the perfect solution to become efficient on Linux. 20% off today!

Download now

Is there a root user on Kali Linux?

The administrator account (“root”) is still created by default on Kali Linux and most Linux distributions. It’s just disabled by default, so we can’t use it directly.

Why is the root user disabled?

Having an account always named the same way with all privileges on the system was a bad idea for obvious security reasons. Hackers knew they just had to find the “root” password to get access to the full system.

That’s why Debian, and so Kali Linux (based on it), decided to disable it by default on fresh installations. Most Linux distributions now have a main user, with other ways to get administrative privileges, which is way better. Hackers have to find the username and the password if they want to get a chance to get full access, which is a task on another level.

Hide your IP address and location with a free VPN:
Try it for free now, with advanced security features.
2900+ servers in 65 countries. It's free. Forever.

Anyway, if you check the list of users created by default when you install Kali Linux, there is still root listed at the beginning, with the ID 0:

It’s just not possible to log in with it.

Use sudo instead of root

The “sudo” command stands for “Super User DO”. It allows any allowed user to run commands with administrative privileges (as if it were run by root directly).

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!

If you take any system administration command, for example:
apt update
It doesn’t work with your current user. Root privileges are required to do this.

But, if your user has the right to use sudo, you can run:
sudo apt update
It might ask for your password, but it will then execute the command successfully.

Any task, command or service that requires the administrative privileges can be run or managed with sudo. So, in short, there is no need to use “root” anymore. Just prefix your commands with “sudo” when you get a “Permission denied” error on Kali Linux.

Warning: The main user (created during the installation) can use “sudo” on Kali Linux. But if you have several users for your system, there are generally not created with the permission to do that. They need to be added to the group “sudo” first. You can do it from your main user account with:
sudo adduser <user> sudo

Switching to the root user

Unless the Kali Linux system was installed many years ago, the root account is most likely disabled, without a password set. On old versions, it was set during the installation, but it’s not the case anymore.

We don’t necessarily need to set a password to switch temporarily to the administrator account. We can simply run this command from the main user session:
sudo su

If a password is required, it’s the one from your current user, not root. In the example below, I’m logged as “pat”, so that this account password that is required (if asked). Once done, you’ll have access to the root terminal (prompt starting with a red “root@hostname”):

From there, any command you use will have administrator privileges directly, there is no need to prefix them with “sudo”, as you are running them as root directly.

To get back to your normal session, type:

So, we have seen that “sudo” is enough in most cases for quick tasks requiring more permissions. And you now have a way to switch to root if needed, for example, to run many commands without having to add sudo for each of them.

In theory, it should be enough, but let’s go a bit further, and see how to really enable and login as root (even if it’s not recommended).

Enable root login on Kali Linux

Before anything else, we can’t log in as root on Kali Linux until a password is set. We can do it with this command:
sudo passwd

Remember, using sudo run the command as root, so “sudo passwd” will change the root password, not yours.

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!

It may first ask for your password, however, and then prompt you to create a new password for the superuser:

Reminder: For security reasons, it’s not advisable to have “root” enabled with the password set. If you do it, please use a strong password. The main criteria for password strength is the number of characters. You can use this password generator to help you find something long but easy to remember.

Anyway, after setting up a password for root, the account is now enabled, and usable as any other user on your system. You can even log in with it from the GUI if you want:

The last thing you may need is to allow it for remote access (SSH typically), as it’s also disabled by default.

Hide your IP address and location with a free VPN:
Try it for free now, with advanced security features.
2900+ servers in 65 countries. It's free. Forever.

Enable root login over SSH

Not only the root user is disabled by default on Kali Linux (without a password set), but the SSH service is also protecting you by preventing remote access with the root user.

If you have SSH enabled, and try to access your Kali Linux system, you’ll get a “Permission Denied” message:

It’s even a worse idea to allow root to remotely access your system (most hacks happen remotely), but I’ll tell you everything you can do, and let you decide from there. So, here is how to allow root access via SSH:

  • SSH is often installed by default on Linux, but if you started with a minimal edition of Kali Linux, you may need to install it first. You can do this with:
    sudo apt install ssh
  • Then, you can open the SSH configuration file with:
    sudo nano /etc/ssh/sshd_config
  • Most lines are commended (starting with #), but you can see the default settings.
    Find a line starting with “PermitRootLogin”:
  • Uncomment it (remove the #) and change “prohibit-password” with “yes”.
  • Save the file and exit (CTRL+X)
  • Restart SSH to apply changes:
    sudo service ssh restart

You should now be able to access your Kali Linux system, logging in directly as root:

While doing this can feel convenient, I can stress enough the fact that this is a major security risk. You can do it temporarily, for a specific reason, maybe for a short time to complete the initial setup. But please — revert your changes as soon as possible once you don’t need it anymore. Using “sudo” is enough in 99.99% of cases.

If you want to completely disable the “root” account, as it was in the beginning, you can lock it with:
sudo passwd -l root

I also recommend reading these related articles on the website:

Whenever you’re ready for more security, here are things you should think about:

- Break free from Gmail: You should be able to choose what happens to your data. With Proton, only you can read your emails. Get private email.

- Protect yourself online: Use a high-speed Swiss VPN that safeguards your privacy. Open-source, no activity logs. Get Proton VPN risk-free.

- Master Linux commands: A sure method to learn (and remember) Linux commands. Useful ones only, one at a time, with clear explanations. Download the e-book.

Similar Posts

Leave a Reply

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