4 Secure Shell

Secure Shell

Secure Socket Shell (SSH) is a network protocol, port 22, that gives users a secure way to access a machine over an unsecured network. It provides strong password authentication and public key authentication, as well as encrypted data communications between two machines connecting over an open network.

Setup

Server

Download and setup Fedora Server (opens in a new tab) as a virtual machine.

Daemon

Install, enable, and start the SSH daemon on the server:

server
dnf install openssh-server
systemctl enable --now sshd

Hostname

Change the server’s hostname to a friendly and memorable name, preferably unique on the network:

server
hostnamectl set-hostname [name]

Address

Get the server’s IPv4 address:

server
hostname -I
# 192.168.68.13, for example

Access

Login to the server from a client; you will be prompted for your remote password:

client
 ssh user@ipaddress

Authorization

Copy your public key from the client to the server:

client
ssh-copy-id user@ipaddress

This adds your key to the list of authorized keys on the server, enabling password-less login using ssh user@ipaddress.

Configuration

Add the following lines to ~/.ssh/config on the client so that you can ssh server directly:

~/.ssh/config
Host server
  HostName 192.168.68.13
  IdentityFile ~/.ssh/id_ed25519
  User user

Resources