In general, it's better to use the sudo command in Linux instead of logging in as root. However, in some situations, you might need to open a root terminal or log in to a Kali Linux system remotely as the root user. In most Linux distributions, including Kali Linux, the root account is disabled by default to prevent users from damaging the system. [1] X Research source However, if you need a root terminal, you can open Kali's Root Terminal Emulator, or enable the root user to allow root logins via SSH or the GUI. Read on to learn how.
Enabling Root in Kali Linux
- By default, you cannot log in to Kali Linux as root. If you need to enable root logins, use sudo passwd to set a root password.
- To open a root terminal, use Ctrl + Alt + X to open a regular terminal, then use sudo -i to get the root shell.
- For security reasons, it's better to run commands with sudo instead of logging in as the root user.
Steps
How to Enable Root in Kali Linux
-
Log in to Kali Linux. If you haven't set up a user account yet, log in with the default user credentials , which is kali as the username, and kali as the password. [3] X Research source
-
Press Ctrl + Alt + T if you're using the GUI. If you aren't logged in via SSH or on the console, press Ctrl + Alt + T to open a terminal window.
-
3Type sudo passwd and press ↵ Enter . You will be prompted to enter the current user's password. [4] X Research source
-
4Enter your user password and press ↵ Enter . Now you will be prompted to create a new password.
-
5
-
Open a root shell. Now that root is enabled, you can become root in the terminal by typing sudo -i and pressing ↵ Enter .
-
Enter the root password. This command opens a root login shell using root's home directory , .bashrc, and .profile. [6] X Research source
How to Log In as Root in KDE or GNOME
-
Type sudo apt update and press ↵ Enter . This command updates the package manager in Kali Linux.
- To be able to log in as root at the GNOME or KDE login prompt, you'll need to install the kali-root-login package. [7] X Research source
- If you haven't already enabled the root user , you will need to do that first.
-
2Type sudo apt install -y kali-root-login and press ↵ Enter . This installs the root login package for Kali Linux and all its dependencies . [8] X Research source
-
Log out of your current user account. To do so, click the power icon at the top-right and select Log Out .
-
Log in to Kali Linux as root. To do so, type "root" in the username field on the login screen, then type the root password you set earlier. This logs you in to the root account. [9] X Research source
-
Press Ctrl + Alt + T to open the terminal. Now that you are logged in as root, every terminal you open will be a root terminal.
How to Log In as Root via SSH
-
1Open sshd_config in a text editor with sudo . The full path to the file is /etc/ssh/sshd_config , and you can open it in any text editor.
- For example, sudo nano /etc/sshd_config will open the config file in the text editor Nano.
- If you haven't already enabled the root user , you will need to do that first.
-
2Add the line PermitRootLogin yes . If the line is already there but no is selected, just change it to yes .
- If your root user needs to be able to log in with an SSH key and not have to enter a password, the line should read PermitRootLogin without-password instead.
-
3Save your changes and restart sshd. After saving sshd_config, use the command sudo systemctl restart ssh to restart the ssh service. Once restarted, you can log in to Kali Linux as root via SSH.
How to Use Sudo Without Entering a Password
-
1Install the kali-grant-root package. An alternative to logging in or su'ing root is to give your account passwordless sudo rights. This is not recommended, as if your account were to be compromised, the hacker would have root privileges on your system. Still, if you need to do this for a certain user for a certain purpose, it is possible. To install the package, run the command sudo apt install -y kali-grant-root . [10] X Research source
-
2Run sudo dpkg-reconfigure kali-grant-root . You will be prompted to choose some options. [11] X Research source
-
3Select "Enable password-less privilege escalation" from the options. You can now run sudo commands without entering your password.
Frequently Asked Questions
-
1What is the kex command to launch Kali Linux? You can open Kali Linux from WSL using the command kex --win -s . If you're launching it from the Windows command line, use wsl -d kali-linux kex --win -s instead. [13] X Research source
- If you're using an ARM device, you may need to use kex --esm --ip --sound if you're experiencing packet loss. [14] X Research source
-
2Why can't I cd to root in Kali Linux? You need root privileges to cd to root's home directory. If you have already enabled the root user, use sudo -i to become root, and you will then be able to cd into root's home directory.
-
3Should I enable root in Kali Linux? There is usually no reason to allow root logins–anything you need to do, you should be able to do it using sudo. When you log in as root, every program you run runs as the root user. If you run something that has an exploit, a skilled hacker could root your system.
Expert Q&A
-
QuestionHow can I change the root password in Kali Linux?Blain Gunter is a Computer Repair Specialist and small business owner based in Bakersfield, California. He was first introduced to computers at the age of five and has over twenty years of experience in his field. He is both an IT consultant and computer repair technician and takes pride in his ability to troubleshoot anything. He works with hardware, software, Windows, macOS, GNU/Linux, and even vintage electronics.To reset the root password in Kali Linux, you would typically use the command line "passwd root" before rebooting. After executing the command, you'll be prompted to enter and confirm the new password twice, but note that the terminal won't display the password as you type it for security reasons. Given that Kali Linux is designed for security forensics and auditing, the method for resetting the root password may be different or slightly more involved than other operating systems. Always refer to the official documentation or user guides for accurate and secure procedures.
Video
Tips
Expert Interview

Thanks for reading our article! If you’d like to learn more about troubleshooting computers and printers, check out our in-depth interview with Blain Gunter .
References
- ↑ https://www.kali.org/docs/introduction/default-credentials/
- ↑ https://www.kali.org/docs/general-use/sudo/#sudo-on-kali
- ↑ https://www.kali.org/docs/introduction/default-credentials/
- ↑ https://www.kali.org/docs/general-use/enabling-root/
- ↑ https://www.kali.org/docs/general-use/enabling-root/
- ↑ https://unix.stackexchange.com/questions/218169/is-there-ever-a-good-reason-to-run-sudo-su
- ↑ https://www.kali.org/docs/general-use/enabling-root/
- ↑ https://www.kali.org/docs/general-use/enabling-root/
- ↑ https://www.youtube.com/watch?v=v9Kwo2-vRFs&t=12s