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, respectively. The protocol specification distinguishes between two major versions that are referred to as SSH-1 and SSH-2.
The best-known application of the protocol is for access to shell accounts on Unix-like operating systems, but it can also be used in a similar fashion for accounts on Windows. It was designed as a replacement for Telnet and other insecure remote shell protocols such as the Berkeley rsh and rexec protocols, which send information, notably passwords, in plaintext, rendering them susceptible to interception and disclosure using packet analysis.The encryption used by SSH is intended to provide confidentiality and integrity of data over an unsecured network, such as the Internet.
You can use your Android phone, remote computer, iPAD or anything to login to a SSH server and execute command as if you’re sitting on that workstation. So let’s see how you can install a SSH server (we will be using openSSH-Server here) on Kali Linux. After this guide you will be able to do the followings:
- Install Kali Linux remote SSH – openSSH server
- Enable Kali Linux remote SSH service on boot
- Change Kali default ssh keys to avoid MITM attack
- Set MOTD – Message of the Day message with a nice ASCII
- Troubleshoot and fix “
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED” error during SSH session.
- Change SSH server port for extra safety
Step 1: Install Kali Linux remote SSH – openSSH server
Issue the following command on Kali Linux terminal to install
[email protected]~:# apt-get install openssh-server
Now the next logical step is to enable ssh server (as you can see I’ve issued the following command above).
[email protected]~:# service ssh start
It works, but there’s a problem. If you restart your Kali Linux machine, SSH server will be disabled.
So we will ensure that SSH server remains up and running all the time (even after restart). Please note that if you don’t want this to happen, then skip Step 2 and move to Step 3. Why? Because if you enable SSH server on your machine, that means your machine will be available via internet and anyone who knows your password (or your password is just ‘123’ or ‘password’ can break into your machine). So use a secured password and if not sure skip to Step 3 for now. Anyway, moving on..
Step 2: Enable Kali Linux remote SSH service
Now we are about to enable SSH service and keep that running the whole time. (changes wont get lost after boot).
First of all remove run levels for SSH.
[email protected]~:# update-rc.d -f ssh remove
Next load SSH defaults to run level
[email protected]~:# update-rc.d -f ssh defaults
Check if SSH service is up and running
[email protected]~:# chkconfig ssh
If you don’t have
chkconfig installed, install via
[email protected]~:# apt-get install chkconfig
You can run
chkconfig to see a lot more too:
[email protected]~:# chkconfig -l ssh (or) [email protected]~:# chkconfig -l