SSH stands for Secure Shell. SSH is used for connecting to a remote computer accessing files and perform administrative tasks.
In this tutorial, learn how to enable SSH on Debian 9 (Stretch) or Debian 10 (Buster).
Before installing new software, update the software repository list with the following command:
sudo apt-get update
The screen confirms that the packages have been updated:
On the system that acts as a server, run the following command:
sudo apt install openssh-server
Enter your password when prompted, then press Y to continue the installation. In this case, the output states that the newest version is already installed.
You can check the status of the SSH service with the following command:
sudo systemctl status ssh
The system confirms that the SSH service is running.
Since SSH controls connections, it can be handy to know how to start and stop the service.
To stop the SSH host server, enter the following:
sudo service ssh stop
If you check the status of the service at this point the system indicates that SSH is inactive. It also indicates the exact date and time it stopped.
To start the SSH service, use the following command:
sudo service ssh start
Stopping the service only lasts until the next reboot.
To turn off SSH indefinitely, enter:
sudo systemctl disable ssh
To re-enable the SSH service, simply replace disable with enable.
If you’re configuring a server locally, you can display the IP address from a terminal window with the following command:
The IP address will be in a format like this:
If you’re connecting to a server that’s already configured, you’ll want to get the IP address from the server’s administrator. Or, you can log in using the server’s hostname or domain name.
Enter the following command to connect to the server using a secure shell:
Replace the UserName with the username of an authorized user on the server. After the @ sign, use the IP address from Step 4, or you can use the domain name. You can also specify a hostname if the server is configured to use one.
When connecting for the first time, the system may prompt you for confirmation. Type ‘yes‘ and then ‘enter‘.
The remote system will prompt you for a password. Use the password that goes with the username you’ve provided.
The command prompt will change to username@hostname, indicating that the commands you are running are being executed on the remote server.
To make your SSH secure, please check other SSH articles from the blog.