How to Enable SSH in Kali Linux

SSH or Secure Shell Protocol is a network protocol used to transmit files between an SSH server and SSH client in an encrypted format.

In this article, you will find how to enable SSH in Kali Linux so that you can securely login into remote machines and transfer files easily. There are other protocols similar to SSH that let you transmit files but they are not that safe as SSH.

enable ssh in kali linux

SSH is mainly used in a client-server model. There will be two ends, the first one is client SSH and the other one is SSH Server. You can read more about SSH here.

Since SSH encrypts all the data, it is super safe and nearly impossible to hijack your sessions or data being sent.

How to Enable SSH in Kali Linux in 2 Minutes

By default, Kali Linux comes with an OpenSSH server installed on it. For some reason, if it is not present in there, then follow the below-given command to get it installed.

$ sudo apt-get install ssh

Now use the below given command to start the SSH server.

$ sudo service ssh start

Now that we are done with installing OpenSSH Server, now let’s just enable Kali Linux Remote SSH Service.

Run the following command to remove run levels

$ sudo update-rc.d -f ssh remove

To load SSH defaults

$ sudo update-rc.d -f ssh defaults

To see if the service is running or not, run the following command

$ sudo chkconfig ssh

Now we have successfully installed and enabled SSH in Kali Linux.

Next is to secure it by changing default Kali SSH Keys. This will help us to avoid Man In The Middle or MITM attacks.

First of all, we need to move Kali SSH to some other folder, for that you may use the below given command.

$ sudo cd /etc/ssh/
sudo mkdir default_kali_keys
sudo mv ssh_host_* default_kali_keys/
sudo dpkg-reconfigure openssh-server

Run the following command to see if the hashes are different.

sudo md5sum ssh_host_*
cd default_kali_keys/
sudo md5sum *

Once verified, next is to restart the SSH server. Use the command given below to restart SSH.

sudo service ssh restart

Additionally, you may also change the SSH Server Port for safety. Execute the following commands for the same.

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config_backup

Use this command to edit the ssh_config file

sudo vi /etc/ssh/sshd_config

Again restart SSH

sudo service ssh restart

To login, use:

ssh username@myhostnaname.com -p 10101

Change the parameters according to the changes you have made.

Conclusion

This is how easy it is to enable and set up SSH on Kali Linux. Now you may perform all task that requires an active SSH service running.

Astro K Joseph
I am Astro and here at IPEE World I write about various Technology content including News, Guides, and Reviews