The Beginner's Guide to SSH

The Beginner's Guide to SSH

Imagine you are an engineer working at a small organisation and you need remote access to an office server to apply a software update.

The data you are handling is sensitive, and the last thing you want is to inadvertently expose it to lurking cyber threats.

You need a secure way to upload the update using an encrypted protocol.?

This ensures that the connection between your computer and the office server remains protected from prying eyes.

How would you go about it??

Enter SSH


What is SSH?


SSH stands for Secure Shell.

In the early days of the internet, it was common for people to use protocols like Telnet and rlogin to connect to remote computers.?

However, these protocols were not very secure, and malicious actors could easily intercept data transmitted (passwords were literally transmitted in plaintext)

In 1995, Tatu Yl?nen, a researcher at the Helsinki University of Technology in Finland, developed SSH, or Secure Shell, to address this security flaw.?

SSH encrypts all data transmission between two computers, making it difficult for eavesdroppers to intercept or modify your traffic.

SSH is now the standard for secure remote access, and it is used by millions of people and businesses worldwide.?

Tasks you can carry out with SSH include:

  • Remote administration: SSH allows you to log in to remote computers and run commands like you were there.
  • File transfer: SSH can be used to transfer files between two computers securely.
  • Port forwarding: SSH can be used to forward network traffic from one port to another, typically on a different IP address or machine.

How to Setup an SSH Connection

For this demonstration, I’ll SSH into another Windows machine on my local network.

Machine A (me) will be the client, with the host/username HP

Machine B will be the server, with the host/username burnaboy

After establishing a connection, I’ll use Secure Copy to transfer a file from A to B.


There are two ways you could establish an SSH connection on Windows:

  1. Using 3rd party software like Putty, a free SSH client tool.
  2. Using OpenSSH, which comes pre-installed in Windows 10.

We’ll use OpenSSH for this tutorial, but feel free to check out Putty.

Note: In most Windows 10 machines, only the OpenSSH client software comes pre-installed. You’ll have to download the OpenSSH server software to set up your machine as a server.

SSH Client Software: Used to send SSH requests

SSH Server Software: Used to listen to and accept SSH requests

Setting Up The Server - Machine B

Before we dive into it, first think of a computer as a bustling building with various entrances, each serving a unique purpose.?

These entrances are known as ports, and they allow specific communication and data transfer types to flow in and out.?

For security reasons, some ports are closed by default, just like most doors in a building are locked.

To allow our server to accept incoming SSH connection requests, we need to provide specific instructions to open the corresponding port, usually TCP port 22.

Here's how to do it:

  1. Open "Apps and Features" using the search bar, then select "Optional Features.

2. Click on “Add a Feature”

3. Search for "OpenSSH Server," check the checkbox next to it, and proceed with the installation.


4. Once the OpenSSH Server is installed, use the search bar to find and open "Services"?and look for "OpenSSH SSH Server."


5. Double-click on it and change the "Startup type" to "Automatic" to ensure it starts automatically with the system. Click "Start," followed by "Apply" and "OK" to confirm the changes.

Setting up the Connection on the Client Side - Machine A

Checking IP Addresses


To check the IP addresses of all devices on your network, including yours, follow these steps:

  • Open PowerShell.
  • View your computer's ARP table by entering the command:

arp -a        

Starting SSH Service

I’ll start the SSH service using the command:

 start-service SSHD        

Note: If I wanted SSH to run on startup so I wouldn't have to start it manually, I’d repeat the services configuration process but on the OpenSSH Client App

To SSH into the server, I'll use the simple command:

ssh [email protected]        

I’ll then be prompted to confirm the connection by typing “yes” before providing a password, in this case, the password to the username burnaboy.?

Once authenticated, I will be logged into a terminal on the server.

To confirm access, I’ve executed the whoami command

Transferring Files with Secure Copy (SCP)

To transfer a file from the client to the server using Secure Copy (SCP), I have two options:

Option 1 - Exit the current terminal and run an SCP command on the client side

I. End the SSH session on the server by typing “exit”

II. Back to my terminal, I’ll use the scp command to copy a file called flowers.txt from my desktop to a folder named "Linkedin Files" on the server.

scp "\Users\HP\Desktop\flowers.txt" "[email protected]:\Users\burnaboy\Desktop\LinkedIn Files"        


Option 2: Reverse SSH into the Client and copy the file directly using this command:

scp "[email protected]:\Users\HP\Desktop\Flowers.txt" "\Users\burnaboy\LinkedIn Files"        

As you can see, I am still logged into the server machine but have reversed SSH'd into the client machine to copy the files I need.

What A Successful File Transfer Looks Like

How Hackers Use SSH

Anyone familiar with the command line interface can pretty much do anything they want on a system they've SSH'd into from anywhere in the world.

Hackers can create backdoors, escalate privileges, steal important information, and even leave without a trace.

That is why in secure enterprise settings, security controls are put in place to prevent authorised personnel from SSHing into servers with passwords only because passwords are susceptible to many forms of attacks.?

SSH ports are closed by default and opened as needed and you're likely to encounter the use of asymmetric encryption and multi-factor authentication, both of which I plan to cover in future issues.

Also Read: CompTIA Security vs Cisco Cyber Ops Certification: 2024 Comparison

David Odes

Cybersecurity and Privacy Professional | Founder, Web Security Lab

1 年
回复

要查看或添加评论,请登录

David Odes的更多文章

社区洞察

其他会员也浏览了