How To Install SSH Server in Linux Systems

SSH (Secure Shell) is a widely used protocol that enables secure, encrypted remote access to Linux systems. This guide explains how to install and configure the OpenSSH server across different Linux distributions.

Understanding SSH

SSH provides secure command-line access, file transfers, and remote command execution while protecting against unauthorized access. Most Linux distributions include the OpenSSH client by default, but the server component may require manual installation.

Client vs. Server

  • OpenSSH Client: Connects securely to remote systems, enabling command-line access and file transfers.
  • OpenSSH Server: Hosts SSH connections, allowing remote users to access and control the system securely.

SSH Requirements

Target Machine (system you want to connect to):

  • OpenSSH Server installed
  • SSH daemon (sshd) running
  • Port 22 open (or custom SSH port)

Source Machine (system you connect from):

  • OpenSSH Client installed
  • Used to initiate connections
  • Most Linux distributions include SSH client by default

Installation Instructions

Debian-based distributions

Target Machine:

sudo apt install openssh-server

Source Machine:

sudo apt install openssh-client

Red Hat-based distributions

Target Machine:

sudo dnf install openssh-server

Source Machine:

sudo dnf install openssh-clients

Arch-based distributions

Target Machine:

sudo pacman -S openssh

Source Machine:

sudo pacman -S openssh

openSUSE-based distributions

Target Machine:

sudo zypper install openssh

Source Machine:

sudo zypper install openssh-clients

Post-Installation Steps (Target Machine)

Start SSH Service

Debian-based:

sudo systemctl start ssh

Red Hat, Arch, openSUSE:

sudo systemctl start sshd

Enable at Boot

Debian-based:

sudo systemctl enable ssh

Red Hat, Arch, openSUSE:

sudo systemctl enable sshd

Check Status

Debian-based:

sudo systemctl status ssh

Red Hat, Arch, openSUSE:

sudo systemctl status sshd

Note: Debian-based systems name the service ssh, while other distributions use sshd.

Firewall Configuration

Ensure the firewall allows traffic on port 22 (or your custom SSH port) for remote connections.

Basic Usage

From the source machine, connect to the target machine using:

ssh username@target_ip_address

Example:

ssh john@192.168.1.100

Only the target machine requires the SSH server. The source machine only needs the SSH client.

By following these steps, you can install and configure an SSH server on Linux, enabling secure remote access and system management.

With SSH properly set up, you’ll have a reliable and secure way to connect to your Linux systems remotely for administration, development, and file transfers.

How To Connect to an SSH Server from a Windows Machine

Post a Comment

Previous Post Next Post

Contact Form