How to Enable the Root Account on Kali Linux

Enable the root user in Linux Kali

Kali Linux, known for its penetration testing tools, has historically allowed direct access as a superuser (root). However, recent versions prioritize creating a standard user account by default, thereby enhancing security. Nevertheless, it is possible to enable the root account if needed.

Why is the root account disabled by default?

Using the root account provides full control over the system, which can increase risks in case of misuse or compromise. By disabling this account by default, Kali Linux encourages users to adopt safer practices by using a standard account and elevating privileges only when necessary.

Procedure to enable the root account

To enable the root account on Kali Linux, follow the steps below:

1. Install the kali-root-login package

This package allows login as root via the graphical interface. Install it by running:

sudo apt update
sudo apt install kali-root-login

2. Set a password for the root account

Open a terminal and enter the following command to set a password for the root account:

sudo passwd root

You will be prompted to enter and confirm the new password.

3. Configure root access for SSH (if needed)

If you want to allow SSH login as root, edit the SSH configuration file:

sudo nano /etc/ssh/sshd_config

Find the line containing PermitRootLogin and change it as follows:

PermitRootLogin yes

Save the changes and restart the SSH service:

sudo systemctl restart ssh

Precautions when using the root account

Using the root account should be done with caution. It is recommended to:

  • Limit root account usage to tasks requiring elevated privileges.
  • Use commands with sudo from a standard user account whenever possible.
  • Ensure the root password is secure and not shared.

Conclusion

Although Kali Linux disables the root account by default for security reasons, it is possible to enable it by following the steps mentioned above. However, it is essential to use this account judiciously to maintain the integrity and security of your system.

Additional resources

For a video demonstration of enabling the root account on Kali Linux, you can watch the following video: