• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Enable SSH on Debian 9 System

Written by Admin, Updated On May 29, 2019
debian, ssh
How to Enable SSH on Debian

SSH stands for Secure Shell Service which is used for secure connection between a client computer and a server. Using SSH you can connect to your system remotely, perform administrative tasks and access files. In this tutorial you will learn how to enable SSH on Debian to communicate securely with server.

Prerequisites#

Before you start with this tutorial, ensure that you’re logged in with non-root user account on your server with sudo privileges.

Install SSH On Debian#

By default, SSH server is not installed on Debian system so you need to install it first. It can be easily install from Debian repository by running following commands.

First of all you need to update apt package manager by typing:

sudo apt update

Now issue the below command to install SSH:

sudo apt install openssh-server

It will prompt you to enter password so just enter it and hit Enter key to continue with installation.

SSH service will be started automatically just after finished installation. You can verify installation by issuing below command:

sudo systemctl status ssh

It should show status as active as given below:

● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
Active: active (running) since Mon 2019-04-25 05:08:17 UTC; 45s ago
Main PID: 1001 (sshd)
Tasks: 1 (limit: 1152)
CGroup: /system.slice/ssh.service
└─1001 /usr/sbin/sshd -D

Press q key to go back to terminal.

Finally, you installed the SSH on your Debian system and you can connect it via SSH from any remote machine. Linux systems have by default installed SSH client and if you have need to connect it from Windows system you can use PuTTY SSH client.

Connecting to SSH Over LAN#

If you want to connect Debian system over LAN then you can use following command:

ssh username@ip_address

You need to change the username with your real Debian user name and ip_address with your Debian system ip address which you want to connect.

If you don’t know ip address of your system you can get it by running below command:

ifconfig

Now go back to remote machine from where you were trying to connect and run below command:

ssh tecnstuff@192.168.43.125

When you will connect it for first time, it will prompt you message like below:

The authenticity of host '192.168.43.125 (192.168.43.125)' can't be established.
ECDSA key fingerprint is SHA256:Rcbtm61VXuErBl7nE2+yowF7lgA2bLSiO/33/7qmRJP.
Are you sure you want to continue connecting (yes/no)?

Type yes and hit Enter key to continue. Next you will be prompted to enter password. Once you provide correct password then you will be logged in and show greeting message as below:

Linux debian 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
...
...

Connecting to SSH Over Internet#

For connect your Debian machine over Internet you must know the public ip address of your machine.

Once you’ve found the IP address you can login by typing:

ssh username@public_ip_address

If you are exposing your machine to the internet you will need to configure the router to accept SSH traffic. Mostly, to configure your router to accept SSH traffic on a non-standard port and forward it to port 22 on the machine running the SSH service.

You can also secure your connection by setting up a SSH key-based authentication to your Ubuntu machine.

Manage SSH Service#

For any reason you want to stop SSH service then you can do it by execute below command:

sudo systemctl stop ssh

To start it you can issue below command and can start it:

sudo systemctl start ssh

You can enable SSH service by running following command:

sudo systemctl enable ssh

Again, you can disable the SSH service by issuing below command:

sudo systemctl disable ssh

Conclusion#

In this tutorial, you have learned how to install and Enable SSH service on Debian 9 system. You can now login remotely to your server using any SSH client from Linux or Windows system.

To increase security of SSH connection by Changing default SSH port to custom one on you system. Get more details about SSH server from official SSH site.

If you have any question or suggestion you can leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install Pip on Ubuntu 18.04 System
Next Article   How to Install Pip on Debian 9 System

Related Posts

  • How to Change Hostname Debian 11

    How to Change Hostname on Debian 11

    February 3, 2023
  • How to Install Python 3.11 on Debian 11

    How to Install Python on Debian 11

    January 25, 2023
  • How to Install Mongodb on Debian 11

    How to Install MongoDB on Debian 11 Linux

    January 11, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Python 3.11 on Debian 11
    How to Install Python on Debian 11 January 25, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook