Skip to content

SSH configuration

ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine.

sshd (OpenSSH Daemon) is the daemon program for ssh.

ssh protocol is intended to provide secure encrypted communications between two untrusted hosts over an insecure network. X11 connections, arbitrary TCP ports and UNIX-domain sockets can also be forwarded over the secure channel.

Install sshd (remote machine)

FROM REMOTE MACHINE

sudo apt-get update &&
sudo apt-get install -y openssh-server

Ensure ssh is enabled and active

systemctl is-enabled ssh && systemctl is-active ssh

If it not the case then you should run

sudo systemctl enabled ssh
sudo systemctl start ssh

You can also want to see status

systemctl status ssh

If you have a personal firewall on this machine, you need to allow to use port 22

sudo ufw allow 22/tcp

More informations about firewall configuration (external link)

You can do a quick test to see if you can join sshd at least from remote machine.

ssh <REMOTE_MACHINE_IP> # from remote machine

If it ask for a password, just cancel (CTRL+c) - everything is okay. Otherwise check previous steps.

Connect through ssh to remote machine (from local machine)

FROM LOCAL MACHINE

First connection test

ssh <REMOTE_MACHINE_IP> # from local machine

If it ask for a password, just cancel (CTRL+c) - everything is okay. Otherwise check previous steps and your network.

Setup ssh accounts (required for each account)

ssh simple manual

See ssh for dummies.

External documentation