Skip to content

Secure Shell (SSH)#

You're going to be using SSH a lot. For Linux, and other Unix like operating systems, it's how you're going to securely connect and execute commands. This allows you to manage remote systems like installing software, starting services, etc. You'll even use SSH when you're using Ansible, Puppet Bolt, and other configuration management tools.

Back in the day, we used Telnet to connect to servers and send commands. Here's what I have to say about Telnet: forget about it and never, ever use it.

Telnet sends everything as plain-text. Someone between your client and the remote system can see the commands you're sending or, even worse, the credentials you're using to access the remote system. Telnet doesn't even ship with most operating systems today - if any at all.

SSH replaces Telnet entirely. It's very secure, encrypting all the traffic between your client and the remote server.

All you need to know at this point in time is how-to use an SSH client locally, generate SSH keys, and then use those to connect to a remote SSH server. We won't cover that here as that's not relevant to the protocol itself. We'll also cover all that later on when we eventually need to use SSH.

With SSH you're able to connect to remote systems and send commands to them. This looks a bit like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
> ssh ubuntu@<IP>
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.11.0-1020-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sat Mar 12 01:05:44 UTC 2022

  System load:  0.0               Processes:             112
  Usage of /:   34.0% of 7.69GB   Users logged in:       0
  Memory usage: 19%               IPv4 address for ens5: 10.2.20.199
  Swap usage:   0%

 * Ubuntu Pro delivers the most comprehensive open source security and
   compliance features.

   https://ubuntu.com/aws/pro

46 updates can be applied immediately.
To see these additional updates run: apt list --upgradable


*** System restart required ***
Last login: Sun Feb 20 07:10:25 2022 from <IP>
ubuntu@ip-10-2-20-199:~$

We can some key information about the system I've just connected to:

  • I logged in using the ubuntu username: ubuntu@<IP> means "user at remote-system"
  • This system is using Ubuntu 20.04.3 LTS as the operating system
  • We've got some stats on the system: the disk is 34.0% full; there are 112 processes running; etc.
  • We have 46 updates waiting for us
  • A system reboot is required (probably because one of those updates is a kernel update)

What I done here is used the ssh command to access a remote system as the ubuntu user. The SSH client has connected to the SSH server and then validated by identity using an SSH keypair.

Key Points#