By default, Kali Linux doesn’t have SSH enabled since it is more used as a desktop version. But for example, if you have a static IP or VPN to your internal network and would like to access your Kali Linux on what you have needed documents, scripts, or installed services that are needed for Penetration testing you would need SSH access, so in this tutorial, we will have a look on how to enable SSH on Kali Linux.

Litle information about SSH

SSH is the preferred method of remote management for most Linux-based systems. Secure Shell (SSH) is a cryptographic network protocol for secure data communication, remote command-line login, remote command execution, and other secure network services between two networked computers. It connects, via a secure channel over an insecure network, a server, and a client running SSH server and SSH client programs.

1). Install OpenSSH server the first step is to go to the terminal window and install OpenSSH Server. You do this by typing the following command in the terminal window:

root@kali~:# apt-get install openssh-server

2). Let’s configure SSH to start when our Kali Linux starts:

2.1). First we need to remove run levels for SSH by issuing the command:

root@kali~:# update-rc.d -f ssh remove

2.2). Now we need load the default SSH run level by issuing the following command:

root@kali~:# update-rc.d -f ssh defaults

3). Change the default SSH keys

3.1). Backup and move default Kali Linux Keys

root@kali:~#  cd /etc/ssh/
root@kali:/etc/ssh#  mkdir insecure_original_default_kali_keys
root@kali:/etc/ssh#  mv ssh_host_*

Output should be:


4). Create new keysType the following command in the terminal window:

root@kali:/etc/ssh#  dpkg-reconfigure openssh-server

5). Root login via SSH on Kali

By default in Kali 2.0 root login is disabled thru SSH. If you want to SSH in thru root (which has tons of security risks) you will need to do the following edit /etc/ssh/sshd_config, and change:

5.1). change line PermitRootLogin without-password

to PermitRootLogin yes

6). Restart the SSH server by executing the following command:

sudo service ssh restart

6.1) Make sure SSH service always restarts on reboot in Kali Linux by executing the following command

update-rc.d -f ssh enable 2 3 4 5

And here you go now you can log in to your Kali Linux terminal using SSH.