How To Install,Start, Stop, Restart OpenSSH In Ubuntu, Debian, Kali, Mint?
Ubuntu is popular Linux distributions used by millions. In order to access Ubuntu systems remotely we use
ssh protocol. So in order to access and manage Ubuntu systems the ssh server should be installed and running without restriction like firewall. In this tutorial we will look how to install, start and troubleshoot SSH service in Ubuntu, Debian, Kali, Mint. We can use this tutorial distributions like Debian, Kali and Mint too because of their origin and system base are the same.
Install SSH Service
We can install OpenSSH service with different ways but the most straight forward way is using
apt package manager. We will use
apt install to install OpenSSh Service. This requires root privileges.
$ apt install openssh-server
Start SSH Service
By default OpenSSh service do not starts automatically. We need to start OpenSSH service explicitly by using
systemctl command is provided by default recent versions of Ubuntu, Debian, Kali and Mint. If it is not installed install
systemctl . In order to get more details look following tutorial.
$ systemctl start ssh
Show SSH Service Status
Services starts, stops but how can we show or list current status of SSH service. We will use
systemctl status command in order to list current status of the SSH.
$ systemctl status ssh
We can see that green
active (running) text that shows SSH service is running.
Restart SSH Service
In some situations we need to restart the SSH service. Configuration change in SSH service requires SSH restart in order to take affect. We can restart SSH service like below. This will reload SSH service with the latest SSH service configuration which resides in
$ systemctl restart ssh
Enable Start of SSH Service At The System Boot
After system reboots or boots the SSH service do not starts automatically and starting it explicitly is a trivial task. We can enable SSH service start automatically after system reboot.
$ systemctl enable ssh
Disable Start of SSH Service At The System Boot
If we do not need to start SSH service at the system boot we can disable automatic start with the following command.
$ systemctl disable ssh