Install and Configure SSH Service in Kali Linux | Linux

In this article, you will learn how to install and configure SSH service in Debian based operating systems like Kali Linux. SSH service is used to access the command line terminal remotely. The SSH service 'Secure Shell' makes use of encryption with public/private keys to make your connection secure.

Installing SSH service on Kali Linux

Kali Linux is pre-installed with Open SSH service, we do not have to install it. If you are using any other Debian based system, then complete the installation by doing these steps.

root@PenTestPundit:~# apt-get update
root@PenTestPundit:~# apt-get install ssh

Now in the next step, we have to generate the public/private key pair, which will help create a secure connection.
root@PenTestPundit:~# ssh-keygen

1. Here you can give the path where the public/private key pair gets stored. The default path is /root/.ssh
2. Type in the password to encrypt the key pair locally, so that no one having physical access to the keys will use them. Hit Enter to not encrypt the key files with a password. (Remember the password you type in here, as you will require it further, we are not giving any password here.)
3. SSH private key file.
4. SSH public key file.

Permit Root Login

In current versions of Open SSH servers, the root user is not allowed to login remotely, to login to root with SSH remotely, we have to edit its configuration file. Open the file /etc/ssh/sshd_config with nano text editor. Then find for the text "Athentication:", under this remove the "#" in front of "PermitRootLogin yes" line. Now save the file by pressing ctrl+x then press y and then at last hit Enter.

root@PenTestPundit:~# nano /etc/ssh/sshd_config

Add a User to Linux

Otherwise, you can add a new user to the system for this purpose, to add a new user, follow commands below.

root@PenTestPundit:~# useradd john
root@PenTestPundit:~# passwd john
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Then start the SSH service, and check the default port 22 for SSH service is listening to it.

root@PenTestPundit:~# service ssh start
root@PenTestPundit:~# netstat -antl | grep 22

That is it, the SSH service is installed, configured, and running on the Kali Linux machine. Now from other machines do the following commands and access the Kali machine remotely.

Access SSH from Windows 10 and all Linux machines

TRUEPHERS | CMD >>ssh root@

Access SSH on older Windows operating systems

We can use the Putty client to connect to the Kali Linux SSH server. Type the IP address and click open, then click yes to save the public keys from the server and then type the username and password to log in.

No comments:

Post a Comment