Secure Shell also called SSH is a network protocol used to remotely access a system in a secure fashion from any location. SSH operates on a client-server paradigm where both client and server communicate with each other through a secure channel. SSH uses the encryption and authentication techniques to establish connection with the remote system, allowing you to access the system and use the command-line interface from another computer.
As a Kali Linux user, you will definitely require accessing the system remotely to perform terminal-related tasks. In that case, you will need the services of SSH, and this guide will provide you with necessary information to enable SSH on Kali Linux.
Outline
- How to Enable SSH on Kali Linux
- How to Use SSH to Remotely Access Kali Linux System
- How to SSH into Kali Linux System as a Root User
- Conclusion
How to Enable SSH on Kali Linux
Before enabling the SSH on Kali Linux, you must ensure SSH is installed on your system. OpenSSH is an SSH server that manages the SSH-related queries on the system. To check whether OpenSSH server is installed on Kali Linux, you can use the below-given command:
The above output ensures that OpenSSH server is installed on Kali Linux, if it’s not, you can install OpenSSH server on the system from the following command:
After installing OpenSSH, you can enable the SSH daemon on Kali Linux from the below-given command:
Then start the SSH daemon on Kali Linux through the following command:
To check whether SSH service is actively running on Kali Linux, simply run the following command:
The active (running) status of SSH daemon ensures that SSH service is successfully running on your system.
How to Use SSH to Remotely Access Kali Linux System
To remotely access Kali Linux system and ensuring SSH service is successfully operating, you can use the below-given steps:
Step 1: Find IP Address of Kali Linux
To remotely access Kali Linux system through SSH, you will require the IP address of your system, you can do it from the below-given command:
Step 2: Open Terminal on a Computer
Now, to access Kali Linux from another computer, you should open a terminal on your other computer. If you are a Windows user, you can open Command Prompt or PowerShell. The Mac and Linux users can simply open the terminal from the desktop or application menu. In all cases, you must have to follow the below-given syntax to remotely access Kali Linux:
Here, ssh command is used to communicate with the SSH server. While, in place of username and IP_address, you have to add your Kali Linux username and IP address (Step 1).
In my case, the username is kali, the IP address of the system is 192.168.221.138, and I am accessing Kali Linux system on Windows PowerShell:
When you SSH into Kali Linux for the first time, you will have to authenticate your device and to keep continuing with the current connection, simply enter yes. Then type the default password for your current user that you are accessing from Kali Linux system:
After entering the password for the current username, you will be able to access the Kali Linux system with the provided username.
How to SSH into Kali Linux System as a Root User
By default, SSH service doesn’t allow login to the system from SSH as a root user. It is done to improve the security of the system by preventing unauthorized users from having a complete charge on your system. If, for some reason, you want to access the Kali Linux system as a root user through SSH, then use the following steps carefully to do that:
Step 1: Open SSH Configuration File
First, open the SSH configuration file on Kali Linux terminal with nano editor using the following command:
Step 2: Modify SSH configuration File
Now, scroll down and find the commented line “PermitRootLogin prohibit-password”, it can be done by removing the # sign:
After uncommenting the line, simply replace “yes” with “prohibit-password”, then save the file by pressing CTRL+X, add Y and enter to move back to the terminal.
Step 3: Restart SSH on Kali Linux
After, you have done the required changes in the configuration file, restart the SSH service to reload those changes:
You can then access the Kali Linux system as a root user, using the root in place of username:
Conclusion
SSH is a useful feature widely used for remotely accessing the system terminal and file sharing between the devices. You can enable SSH on Kali Linux using the systemctl command followed by the restart ssh keyword. You should also start the SSH service using the systemctl command with the start ssh keyword. After enabling and starting the SSH service, you can access the Kali Linux system as a normal user using the IP address of the remote system. To access the Kali Linux system as a root user, you must make some changes in the configuration file, reload the SSH service and use root instead of username to access the system remotely.
By day, I am an engineer and researcher, building bridges and figuring out how the universe works. But when the clock strikes five, I turn into a wordsmith!
I write about my adventures on my blog, sharing tips and tricks to help others join the tech fun. I have worked on Raspberry Pi, Ubuntu, Debian, and Laptops. Right now, I have accepted the challenge of working on the Kali Linux system, and with my vast expertise in Linux systems, I will help users overcome the challenges through my blogs.