PDF download Download Article
Everything you need to know to access Kali as root
PDF download Download Article

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] 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.
Section 1 of 8:

How to Open a Root Terminal in Kali Linux

PDF download Download Article
  1. You can open a root terminal in Kali Linux without enabling the root user. Even if you're just signed in as your regular user account, you can open a root terminal from the GUI to avoid having to use sudo to enter a bunch of commands. To open a root terminal, click the menu at the upper-left corner, type root , and then click Root Terminal Emulator in the search results.
    • The root user account is not enabled by default in Kali Linux. While you can enable it if need be, it is not recommended and is usually not needed. [2]
    • You can also open a terminal in Kali by pressing Ctrl + Alt + T , then use the command sudo -i to make it a root terminal.
    • If you just need to run a few commands as root, just type sudo before them to run them with superuser rights. For example, sudo apt upgrade upgrades all installed packages on the system.
  2. Advertisement
Section 2 of 8:

How to Enable Root in Kali Linux

PDF download Download Article
  1. 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]
  2. If you aren't logged in via SSH or on the console, press Ctrl + Alt + T to open a terminal window.
  3. 3
    Type sudo passwd and press Enter . You will be prompted to enter the current user's password. [4]
  4. 4
    Enter your user password and press Enter . Now you will be prompted to create a new password.
  5. 5
    Enter and confirm a new root password. This should be different from your user account password. Once you confirm the new password, the root account will be enabled. [5]
    • If you want to log in to Kali Linux as root, you will need to allow root logins via SSH or GNOME/KDE .
  6. Now that root is enabled, you can become root in the terminal by typing sudo -i and pressing Enter .
  7. This command opens a root login shell using root's home directory , .bashrc, and .profile. [6]
  8. Advertisement
Section 3 of 8:

PDF download Download Article
  1. 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]
    • If you haven't already enabled the root user , you will need to do that first.
  2. 2
    Type sudo apt install -y kali-root-login and press Enter . This installs the root login package for Kali Linux and all its dependencies . [8]
  3. To do so, click the power icon at the top-right and select Log Out .
  4. 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]
  5. Now that you are logged in as root, every terminal you open will be a root terminal.
  6. Advertisement
Section 4 of 8:

PDF download Download Article
  1. 1
    Open 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.
  2. 2
    Add 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.
  3. 3
    Save 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.
  4. Advertisement
Section 5 of 8:

How to Use Sudo Without Entering a Password

PDF download Download Article
  1. 1
    Install 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]
  2. 2
    Run sudo dpkg-reconfigure kali-grant-root . You will be prompted to choose some options. [11]
  3. 3
    Select "Enable password-less privilege escalation" from the options. You can now run sudo commands without entering your password.
  4. Advertisement
Section 6 of 8:

Default Logins in Kali Linux

PDF download Download Article
  1. 1
    Default password for new installs This default password will work for Live Boot and pre-created virtual machines and ARM images: [12]
    • User: kali
    • Password: kali
  2. 2
    Vagrant base box images
    • User: vagrant
    • Password: vagrant
  3. 3
    Amazon EC2
    • User: kali
    • Password: (your SSH key)
  4. Advertisement
Section 7 of 8:

Frequently Asked Questions

PDF download Download Article
  1. 1
    What 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]
    • If you're using an ARM device, you may need to use kex --esm --ip --sound if you're experiencing packet loss. [14]
  2. 2
    Why 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.
  3. 3
    Should 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.
  4. Advertisement
Section 8 of 8:

Tips

PDF download Download Article
    • When typing a password, a Linux terminal won't display any characters or asterisks.
    • Use caution when logged in as a root user. There is nothing to stop you from accidentally deleting a critical system file or executing a critical command that causes permanent damage to your system.


Expert Q&A

Search
Add New Question
  • Question
    How can I change the root password in Kali Linux?
    Blain Gunter
    Computer Repair Specialist
    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.
    Computer Repair Specialist
    Expert Answer
    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.
Ask a Question
      Advertisement

      Video

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!

      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 .

      About This Article

      Thanks to all authors for creating a page that has been read 89,015 times.

      Is this article up to date?

      Advertisement