How to Install SSH on Debian 12, 11 or 10

SSH, commonly known as Secure Shell, is an essential protocol that offers a secure avenue for accessing remote systems. Understanding its significance and core functionalities is crucial for those aiming to install SSH on Debian 12 Bookworm or the older stable releases of Debian 11 Bullseye or Debian 10 Buster. This encrypted communication tool is popular among developers and system administrators for its robust security features.

Key Advantages of SSH:

  • Data Encryption: One of SSH’s primary strengths is its ability to encrypt data during transmission, ensuring that sensitive information remains confidential and protected from potential threats.
  • User Authentication: SSH employs multiple authentication mechanisms, such as passwords and SSH keys, to validate the identity of users trying to access a remote system.
  • Remote Connectivity: With SSH, users can seamlessly access and manage remote servers and workstations, irrespective of location, as long as they have an internet connection.
  • Port Forwarding Capabilities: SSH offers the flexibility to forward ports, enabling users to access services on remote servers securely.

SSH vs. Other Protocols:

  • Unlike Telnet, which sends data as plain text, SSH encrypts all data.
  • While FTP transmits data and login credentials in an unencrypted format, SSH encrypts all transmitted information, including authentication details.
  • Overall, SSH stands out as a more secure and reliable method for remote access compared to other available protocols.

To wrap up the introduction, SSH is an indispensable tool that provides a secure environment for remote access and data transmission. This guide will walk you through installing and setting up SSH on Debian 12 Bookworm, Debian 11 Bullseye, or Debian 10 Buster. Additionally, we’ll touch upon some fundamental configurations to help you optimize your SSH experience.

Install SSH on Debian 12, 11, or 10 via APT

Step 1: Update Debian Packages Before SSH Installation

To use SSH on your Debian system, you must first install the SSH server. This will allow you to access and manage your system securely and remotely. Here are the steps to install the SSH server:

First, update the package repository by executing the following command:

sudo apt update && sudo apt upgrade

This command will ensure your system has the latest information and updated packages.

Step 2: Install OpenSSH on Debian via APT Command

Install the SSH server by executing the following command:

sudo apt install openssh-server

This command will install the SSH server on your system.

Step 3: Verify Installation

Once the installation is complete, the SSH server will be enabled by default and will start automatically whenever you boot your system. You can check the status of the SSH server by executing the following command:

systemctl status ssh

This will show you whether the SSH server is running or not.

With the SSH server installed and running, you can now configure it to your needs. The next step is to configure SSH on your Debian system.

Configure SSH on Debian 12, 11 or 10

After installing the SSH server on your Debian system, you must configure it to meet your needs. The configuration file for SSH is located at /etc/ssh/sshd_config.

Open SSHD Configuration File

To open the configuration file for editing, execute the following command in the terminal:

sudo nano /etc/ssh/sshd_config

This will open the configuration file in the nano editor, allowing you to make necessary changes.

Here are some important configuration options that you may want to consider:

Change the default SSH port:

SSH uses port 22 for communication. However, this port is often targeted by attackers. You may want to change the default port to a different number to increase security. To do this, locate the following line in the configuration file:

#Port 22

Uncomment the line and replace 22 with your desired port number.

Disable root login:

By default, the root user can log in via SSH. However, it is generally recommended to disable this to increase security. To do this, locate the following line in the configuration file:

#PermitRootLogin yes

Change “yes” to “no” to disable root login.

Allow or deny specific users:

You can also allow or deny specific users from accessing your system via SSH. To do this, add the following lines to the configuration file:

AllowUsers user1 user2
DenyUsers user3 user4

Replace “user1”, “user2”, “user3”, and “user4” with the actual usernames. After making changes to the configuration file, save and close it by pressing Ctrl+X, Y, and Enter.

Finally, to apply the changes, restart the SSH service using the following command:

sudo systemctl restart ssh

This will restart the SSH server with the new configuration settings. With SSH adequately configured on your Debian system, you can now connect to remote servers and manage your system securely.

Commands to Connect with SSH on Debian 12, 11 or10

After installing and setting up SSH on your Debian system, you can remotely access and manage it using an SSH client.

First, determine your Debian system’s IP address. In the terminal, type:

ip addr show

Find the line beginning with “inet” followed by an IP address. This is your system’s IP address.

On the device you want to connect from, open the terminal. Type:

ssh username@ip_address

Replace “username” with your Debian system’s username and “ip_address” with the IP address you found earlier. For instance, if the username is “joshua” and the IP address is “192.168.1.100”, type:

ssh joshua@192.168.1.100

If it’s your first connection to this server, you’ll see a prompt asking to accept the SSH key. Type “yes” and press Enter. Next, you’ll need to input the password for the username you provided. Once done, you’ll be logged into your Debian system via SSH.

With SSH access, you can run various commands. For instance, “ls” shows files and directories, “cd” lets you navigate, and “nano” lets you edit files.

Conclusion

You’ve learned to install and activate SSH on Debian 12 Bookworm, Debian 11 Bullseye, and Debian 10 Buster. Using these steps, you can access and control your Debian systems from a distance. SSH ensures that your data remains safe by encrypting it as it transfers.

Leave a Comment


Your Mastodon Instance
Share to...