Debian Enable SSH: Step-by-Step Guide to Secure Remote Access

Debian Enable SSH

Table of Contents

Get up to 50% off now

Become a partner with CyberPanel and gain access to an incredible offer of up to 50% off on CyberPanel add-ons. Plus, as a partner, you’ll also benefit from comprehensive marketing support and a whole lot more. Join us on this journey today!

For software developers, system administrators, and other IT professionals, the ability to remotely access a Debian system is of utmost importance. If you are deploying a web server or maintaining a cloud infrastructure or if you are troubleshooting a remote system, SSH (Secure Shell) invokes a rapid and secure means of access to your Debian machine. However, remote access is not set up by default to be available and thus needs to be configured manually. This guide aims to assist you with the methods for “Debian Enable SSH”.

In this article, we’re going to detail the process of enabling an SSH server on Debian to configure and secure remote connections. We will also include how to enable ssh on Debian 12 and make the process of enabling ssh on other Debian versions seamless. Knowing how to configure SSH on Debian will enhance remote working capabilities and system management for novice and advanced Linux users.

The Reasons for Debian Enable SSH Server

Linux operating systems can be accessed and managed remotely using the SSH (Secure Shell) protocol. Therefore, having an SSH connection enabled on Debian allows you to:

  • Remotely access your computer through another machine.
  • Use SCP or SFTP to transfer files between PCs securely.
  • Run commands and predetermined scripts which aid in the automation of system maintenance.
  • Access servers without physical presence which is essential for enterprise IT environments, web hosting, and cloud computing services. 

For several Debian installations, it could be that SSH has not been enabled due to a lack of security. However, it is relatively easy to enable and once it is done, it is possible to connect to your Debian system from anywhere in a secure manner.

Requirements for Debian Enable SSH

Before you begin, double-check if you have the following things:

  • Debian-Based Operating Systems: This guide works with Debian versions 9 through 12.
  • Access to Git or Root Account: Admin privileges are a must for installing and setting up SSH.
  • Connection to the Internet: This is compulsory for downloading and installing OpenSSH Server.
  • Terminal or SSH Client: If using remote access, an SSH client is required. Example of such clients are as follows:
    • Linux/Apple: Terminal
    • Windows: PowerShell/ Putty
  • Firewall Settings: If UFW (Uncomplicated Firewall) is being used, SSH access should be permitted.

How to Debian Enable SSH (Step-by-Step Guide)

How to Enable SSH in Debian (Complete Detailed Instructions)

Tech Delivered to Your Inbox!

Get exclusive access to all things tech-savvy, and be the first to receive 

the latest updates directly in your inbox.

Step 1. Determine If SSH Is Installed on Your Debian System

To begin, check if you already have SSH installed on your machine:

dpkg -l | grep openssh-server

Output (if installed):

ii  openssh-server   1:8.4p1-5   amd64   secure shell (SSH) server, for secure access from remote machines

If there is no output, it means SSH will not be present and you should move to the second step. 

Step 2. Install OpenSSH Server on Linux Debian

To install OpenSSH Server, execute:

sudo apt update

sudo apt install openssh-server -y

After completing this step, check if the SSH service is active:

sudo systemctl status ssh

Output:

● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2024-02-17 12:34:56 UTC; 5s ago

In case the SSH service isn’t running, you can turn it on manually:

sudo systemctl start ssh

Step 3. Set Up Debian SSH To Enable It On System Boot

To make sure SSH is turned on for the subsequent logins, use: 

sudo systemctl enable ssh

This command guarantees that SSH will always be active after a reboot sequence of the device.

Step 4: Configure the Firewall to Allow SSH Connections

In case a firewall (UFW) is active, you should permit SSH connections:

Enhance Your CyerPanel Experience Today!
Discover a world of enhanced features and show your support for our ongoing development with CyberPanel add-ons. Elevate your experience today!

sudo ufw allow ssh

sudo ufw enable

To confirm, inspect the firewall settings:

sudo ufw status

Output:

Status: active

To                         Action      From

--                         ------      ----

22/tcp                     ALLOW       Anywhere

Make necessary changes on the firewall if in use a different SSH port from the default one (non-standard ports should be addressed in the firewall rules above).

Step 5: Use SSH to Connect to Your Computer Running the Debian Operating System

You can now connect to your server with Debian installed on it, as you have already turned on SSH.

Determine your server’s IP address 

To get your server’s IP address, run this command: 

ip a

Output:

2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000

    inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic ens33

Your server’s IP address is 192.168.1.100 (adjust as needed).

Accessing Your Server from Another Computer

To do that on another computer use: 

ssh username@your-server-ip

Example: 

If the system asks you to “accept,” type yes to agree with the SSH key fingerprint.

How to Enable SSH Debian 12 (Lastest Version)

To enable SSH on Debian 12, follow the instructions as before, but note that Debian 12 implements more stringent security measures, thus it is essential to update the SSH configuration.

Edit SSH Configuration File

To make such configurations, open the terminal and type:

sudo nano /etc/ssh/sshd_config

In the opened configuration file, make the following changes:

PermitRootLogin no

PasswordAuthentication yes

AllowUsers your-username
  • root login is disabled by setting PermitRootLogin to no.
  • PasswordAuthentication yes disables root login.
  • Restricts SSH access to specific users via AllowUsers your-username.
  • AllowUsers your-username ensures SetSSHAccessToSpecificUsersOnServer.

To save the changes made, press (CTRL+X), then select Y and finally press Enter.

After making the changes, restart SSH to allow new settings to work:

sudo systemctl restart ssh

Strengthening SSH Security

For enhanced security, the following steps should be followed:

Modify The Default Port for SSH

To do this, edit /etc/ssh/sshd_config and set the desired port.

Port 2222

To make the applied changes take effect, restart SSH:

sudo systemctl restart ssh

Then change the firewall settings:

sudo ufw allow 2222/tcp

SSH Key Authentication Methods

On the client machine type the following:

ssh-keygen -t rsa -b 4096
ssh-copy-id username@your-server-ip

Disable Password Authentication (For Key-Based Logins)

To make configurations in the file, use the command below:

PasswordAuthentication no

Complete the task by restarting ssh.

Function of CyberPanel in SSH Management in a Debian Environment

CyberPanel

For those operating with a server that is based on Debian, CyberPanel i.e. robust web hosting control panel makes things easier by helping in the configuration of SSH.

How CyberPanel Helps in SSH Admin

  • One-Click SSH Management: Enable or disable SSH seamlessly from the panel.
  • Firewall & Security Settings: Set up SSH-related firewall rules by default.
  • User Access Control: Allow only a subset of users to make SSH logins.
  • Server Monitoring: Monitor all SSH activities and security incidents.

Now even novice users can manage remote access with ease through CyberPanel.

FAQs: Debian Enable SSH

1. What is the procedure to establish SSH in Debian?

The first step is to Install OpenSSH Server.

apt update && apt install openssh-server -y

Start SSH:

systemctl start ssh

systemctl enable ssh

2. On Debian, is SSH switched on as default?

Not by default as it is turned off for security purposes. It is something that would need to be installed and enabled.

3. What is the way to enable SSH for users in Debian 12?

The same process applies, but the /etc/ssh/sshd_config file has to be edited to allow users to log in.

4. What is the method to alter the SSH port?

The port can be changed by editing the /etc/ssh/sshd_config file, and setting the port to 2222, then restarting the SSH.

5. What are the steps I need to take to secure my SSH access?

Utilize authentication based on keys.

Prevent root logins.

Modify the SSH port.

6  . Can I SSH to Debian from a Windows machine?

Yes. Use:

PowerShell: ssh username@server-ip

PuTTY: GUI-based SSH client.

Final Thoughts: Secure Your Debian System Using SSH

Activating SSH on any system is an important procedure for facilitating remote control and management of servers. Perform these steps and attain complete unrestricted access to your Debian server. Managing a hosting environment can be difficult, but SSH configuration is made easy with CyberPanel.Are You Prepped Up for SSH on Debian?

What are you waiting for? Go and fortify your Debian system Today!

Hasib Iftikhar
I'm Hasib Iftikhar, a dedicated technical writer at CyberPanel, joining the team in July 2024. With three years of extensive experience in content writing, I specialize in copywriting, article writing, guest posting, affiliate content writing, and SEO. My expertise ensures that each piece of content I create is engaging, informative, and optimized for search engines, helping businesses enhance their online presence and reach their target audience effectively.
Unlock Benefits

Become a Community Member

SIMPLIFY SETUP, MAXIMIZE EFFICIENCY!
Setting up CyberPanel is a breeze. We’ll handle the installation so you can concentrate on your website. Start now for a secure, stable, and blazing-fast performance!