PTENES
INEMA.CLUBPROSSH and SSH Keys

Track · SSH and VPS

Your entry point
to the VPS itself

Nine short lessons to help you connect to your VPS through the terminal, understand SSH keys, and resolve the most common connection issues on your own—without waiting for technical support for every adjustment.

Track · Lesson 1

What it is SSH

By the end of this lesson, you’ll recognize the 4 elements every remote connection command needs — without memorizing any code.

Today, when something gets stuck in the automation running on your VPS, you depend on messaging support and waiting. The next lessons will help you handle that yourself — but first, you need to understand what’s actually happening when someone “logs in” to a server. Without that foundation, every command is just memorization.

↓ scroll to study

01 The private corridor to your VPS

A VPS is a computer that stays on 24 hours a day in a data center, running your business’s automation. The SSH is the private corridor that connects your computer directly to that server — without having to travel to the data center.

After Marta, a beauty salon owner, connects via SSH to the VPS that runs automatic appointment confirmations over WhatsApp, everything she types runs there, not on her laptop.

02 What this corridor is for in practice

With SSH, you can log in to the VPS and take care of things yourself that currently require support: restart a stuck service, check why a message wasn't sent, edit a file, or just confirm that everything is working.

Ricardo, a clothing store owner, uses an automation that posts new collection items on its own. When it stops posting, SSH lets him access the VPS and see what happened that same minute — instead of waiting for someone to become available.

You don’t need to understand the entire server—you just need to know how to open the right door when necessary.

03 The 4 elements of every connection

Every SSH connection—Marta’s, Ricardo’s, anyone’s—always depends on the same 4 elements, no more and no less:

  • The SSH client — the program on your own computer that starts the conversation.
  • The SSH server — the service running inside the VPS, waiting for someone to knock.
  • The VPS IP — the public address that tells you where it is, like a house number.
  • A authentication — a password or key, proof that it’s really you logging in.

Test yourself

If you switch VPS providers (for example, Hostinger instead of AWS), which of the 4 elements changes?

04 What changes when you understand this

A connection command looks like a row of strange symbols the first time you see it. After this lesson, it’s just this: client, server, IP, and authentication, in a fixed order—nothing more.

Marta was looking at ssh root@123.123.123.123 like a puzzle. Now she knows: it’s her client (the ssh) authenticating a user (root) at an address (123.123.123.123) — the 4 elements, in the same order as always.

Before

A connection command was a block of text to copy without understanding, hoping it would work.

Then

The same command becomes 4 recognizable pieces—and you know which one to adjust when something changes.

Practice now 0/2 done

Identify the 4 elements in a real-world case

Read the mini case below and identify the 4 elements — ~8 min.

There’s nothing here to break: this is just reading and reasoning, without touching any real VPS.

Mini case

Marta wants to log in to the VPS where her WhatsApp automation runs. She opens the terminal on her own laptop and types ssh admin@45.77.12.9. A prompt appears asking for the password; she enters it and gets in. Ricardo, at the clothing store, does the same thing, except his VPS has a different address and username.

view the explained answer

IP: 45.77.12.9 — Marta’s VPS address. User: admin — who is authenticating. Her laptop’s terminal is the client; the SSH service running inside the VPS is the server. In Ricardo’s case, the IP and username change because they belong to a different VPS — but the 4 roles (client, server, IP, authentication) stay the same, because that’s how SSH always works.

You can now recognize the 4 elements of any SSH connection—the foundation for all the upcoming lessons.

Summary

  • SSH is the private corridor that connects your computer directly to a VPS that runs 24 hours a day.
  • Every connection always depends on the same 4 elements: client, server, IP, and authentication.
  • Understanding these 4 elements turns a connection command from an “enigma” into something recognizable.

Your next step

You can now break down any SSH connection command into its 4 elements.

For the next 15 minutes: open the connection command for your own VPS (if you’ve saved it somewhere) and identify on your own which part is the IP and which is the username.

In the next lesson, you’ll check whether SSH is already set up on your Windows computer and make your first real connection.

1"> [ {"front":"What are the 4 elements every SSH connection needs?","back":"SSH client, SSH server, VPS IP, and authentication (password or key)."}, {"front":"You switch your VPS from Hostinger to AWS. What changes in the 4 elements, and what stays the same?","back":"The IP changes (it's a different server); the client, protocol, and authentication method stay the same."}, {"front":"What's the difference between the 'SSH client' and the 'SSH server'?","back":"The client is the program on your computer that starts the connection; the server is the service inside the VPS that waits and responds."}, {"front":"Marta gets a password prompt when trying to connect. Which of the 4 elements does this prompt belong to?","back":"Authentication—the proof that it's really her logging in."} ]

Track · Lesson 2

Setting up your computer
e a first connection

By the end of this lesson, you’ll check whether SSH is already set up on your Windows computer and connect to your own VPS for the first time using a password.

All the theory from Lesson 1 only becomes useful when you open the passage for real, once. It’s the difference between knowing what a car key is and sitting in the driver’s seat.

↓ scroll to study

01 Checking whether SSH is already on your Windows PC

This is a simple recipe: you open the terminal (CMD or PowerShell), type a check command and read the response.

Marta opens the Start menu, types "cmd," opens Command Prompt, and types ssh -V. If something like OpenSSH_for_Windows, SSH is already installed — she doesn't need to do anything else at this stage.

ssh -V

02 If it isn’t installed

If the command isn’t recognized, Windows 10/11 has SSH ready to enable, without downloading anything from elsewhere: Configurações → Apps → Recursos opcionais → Adicionar recurso → OpenSSH Client.

Ricardo ran into this at the store: the command returned an error the first time, he enabled the feature using the path above, reopened the terminal, and the ssh -V worked.

Common error

Test the command without closing and reopening the terminal after enabling the feature. Windows only recognizes SSH in a new window—close the old terminal and open another one before testing again.

03 The connection command and the first prompt

Once SSH is ready, connecting is just one line: ssh usuário@IP_DA_VPS. Marta types ssh root@123.123.123.123 (the IP is always the IP of her VPS, not this example).

The first time anyone connects to a new VPS, a question appears: Are you sure you want to continue connecting?. This is the computer confirming that you recognize this server—type yes and press Enter.

Test yourself

Does this confirmation prompt appear every time you connect, or only the first time with that VPS?

04 Typing the password (which doesn’t appear on screen)

After the yes, the VPS asks for the password. The first time, Ricardo thought the keyboard had frozen: no letters appeared as he typed.

That’s intentional: for security, the password never appears on screen, not even as dots. Type normally and press Enter — it’s being received; it just isn’t shown.

First connection checklist

  1. Open the terminal (CMD or PowerShell).
  2. Type ssh usuário@IP_DA_VPS with the details for your own VPS.
  3. The first time, type yes when prompted.
  4. Type the password (it won’t appear) and press Enter.

Practice now 0/3 done

Connect to your VPS for the first time

Confirm SSH is installed and log in to your VPS with a password — ~10 min.

Connecting and looking around doesn't change anything on the VPS. If something seems wrong, type exit and you exit without changing anything.

ssh -V
ssh usuario@IP_DA_VPS

You just logged in to your own VPS for the first time—the same thing Marta and Ricardo do whenever they need to take a closer look at something.

Summary

  • Windows 10/11 already includes a way to enable SSH, without installing anything from outside.
  • The first connection to a new VPS always asks you to confirm (yes) — only the first time.
  • For security, the password doesn’t appear on screen, but it’s still being received.

Your next step

You just connected to your own VPS for the first time using a password.

For the next 15 minutes: log in to your VPS again and notice the "prompt" (the text before the cursor) — it changes to show that you’re now inside the server.

In the next lesson, you’ll learn the basic commands for finding your way around and working on this VPS without worrying about getting lost.

2"> [ {"front":"You typed ssh -V and Windows said it doesn't recognize the command. What's the next step?","back":"Enable OpenSSH Client in Settings → Apps → Optional Features, then close and open a new terminal."}, {"front":"When you type the password in the terminal, no letters or dots appear on the screen. Does that mean there's a problem?","back":"No—this is a security feature of SSH itself; what you type is still received normally."}, {"front":"The 3rd time you connect to the same VPS, should the 'are you sure...' question appear again?","back":"No—it only appears the first time you connect to that specific server."} ]

Track · Lesson 3

Moving around inside
from the server

By the end of this lesson, you’ll find your way around your VPS, move between folders, check basic information, and exit safely.

After logging in (lesson 2), the first surprise for anyone who’s never used a terminal is not knowing where they are or what to do next. These 5 commands solve 90% of “I’m lost” moments.

↓ scroll to study

01 Where you are and what’s here

Once you’re in, you can confirm two things: where you are and what’s around you. pwd shows the path to the current folder; ls lists the files and folders inside it.

Marta logs in to the VPS and types pwd and see something like /root — the “room” where it arrived. Then type ls and see the WhatsApp automation files stored there.

pwd
ls

02 Moving between folders

To open a folder, use cd nome-da-pasta ("cd" for changing directories). To go back one folder, cd .. — the two dots mean “the folder above.”

Ricardo wants to see the folder for the post automation: he types cd automacao, confirm with pwd, and when you're done looking, type cd .. to return to where you came from.

Common error

Forgetting the space between “cd” and the folder name, or misspelling the name. The terminal is very literal— cdautomacao doesn’t work, and a wrong folder name returns "not found." Check with ls the exact name before you enter.

03 Viewing information and keeping the system up to date

uname -a shows system information (which Linux version is running). On servers based on Ubuntu or Debian—the most common ones for automation VPSs— sudo apt update && sudo apt upgrade -y updates the installed programs.

Marta runs this update once a month on the salon’s VPS, just like she updates her phone — it’s preventive maintenance, not a fix for a specific problem.

uname -a
sudo apt update && sudo apt upgrade -y

Test yourself

Do you need to run the update command every time you log in to the VPS?

04 Exiting safely

To leave the VPS and return to your own computer, type exit and press Enter. The prompt changes back, confirming that you are no longer "inside" the server.

Ricardo finishes checking the automation and types exit, and sees the terminal on his own laptop again — a sign that any command he types now runs on the laptop, no longer on the VPS.

Basic navigation checklist

  1. pwd — where I am.
  2. ls — what’s here.
  3. cd nome / cd .. — enter / go back to a folder.
  4. exit — safely exit the VPS.

Practice now 0/2 done

Explore your VPS safely

Run the 4 location commands and exit safely — ~10 min.

pwd, ls, uname -a e exit only read information — none of them deletes or changes anything. If something looks strange, exit always gets you out of there.

pwd
ls
cd nome-de-uma-pasta-que-voce-viu-no-ls
cd ..
exit

You just learned how to move around inside your VPS without relying on anyone to “just take a look.”

Summary

  • pwd e ls show where you are and what’s there—always the first step.
  • cd enters a folder, cd .. back — the terminal is literal about names and spaces.
  • exit exits the VPS safely and gives control back to your computer.

Your next step

You can now find your way around and navigate inside your VPS without getting stuck.

For the next 15 minutes: log in to the VPS and run ls, choose a folder you recognize and enter it with cd — then exit with exit.

In the next lesson, you’ll learn about SSH keys — the safest way to log in without typing a password every time.

3"> [ {"front":"You want to go back one folder but don't know its name. Which command do you use?","back":"cd .. — the two dots mean 'the folder above'; you don't need to know its name."}, {"front":"Diagnosis: you typed cd automcao and got 'not found.' What's the most likely cause?","back":"A typo in the folder name—check the exact name with ls before trying again."}, {"front":"After running sudo apt update && sudo apt upgrade -y, do you need to run it again the next time you connect?","back":"No—it's periodic maintenance, not a required step for every connection."} ]

Track · Lesson 4

Understanding your
SSH keys

By the end of this lesson, you’ll identify which file is private and which is public in your computer’s key folder — and understand why having multiple keys is normal.

Starting with lesson 6, you’ll create your own key. Before that, you need to understand what an SSH key is and where it lives — otherwise, every next step becomes memorization all over again.

↓ scroll to study

01 Why having more than one key is normal

A SSH key is a way to log in without typing a password. And just as you have different keys for your house and car, it’s common to have a different SSH key for each service.

Marta has one key for the salon’s VPS and another for GitHub, where she keeps the automation code. They’re separate keys, each opening only the door it belongs to.

02 Where these keys live on your computer

On Windows, keys are stored in a hidden folder called .ssh, inside your user folder: C:\Users\SEU_USUARIO\.ssh\. On Linux or Mac, the same place is called ~/.ssh/.

Ricardo found his folder at C:\Users\ricardo\.ssh\ — the same pattern, just replacing it with his Windows username.

The folder .ssh is a drawer just for you — each key inside it opens a specific door.

03 Identifying the files inside the folder

Inside .ssh you may find names like id_ed25519, hostinger_vps.pub, config e known_hosts. The rule for recognizing it is simple:

  • File without .pub at the end = private key.
  • File with .pub at the end = public key.
  • config = connection shortcuts (lesson 8).
  • known_hosts = list of servers already confirmed (the "yes" question in lesson 2).

Test yourself

Marta sees two files: hostinger_vps e hostinger_vps.pub. Which one is the private key?

04 The golden rule: the private key never leaves here

The public key (.pub) can be placed on any VPS, on GitHub, on GitLab — it only serves to "recognize" the corresponding private key, never to log in by itself.

The private key should never be shared, copied to the public cloud, or sent in a message. Ricardo keeps his only on his own laptop, just as he keeps the store's physical key with him and never lends anyone a copy of the key.

Before

A single password that anyone can try to guess by trying over and over.

Then

A key pair: the public key shared wherever needed, the private key kept only by you—impossible to guess by repeated attempts.

Practice now 0/2 done

Identify your own keys

List the files in your .ssh folder and classify each one — ~8 min.

Listing files only shows their names; it doesn’t open or change anything inside them. No risk.

dir %USERPROFILE%\.ssh

You can now recognize, in your own folder, what’s private and what can be shared.

Summary

  • Having more than one SSH key is normal—each service can have its own.
  • The keys live in the folder .ssh of your user account on Windows, Linux, or Mac.
  • The rule for separating the files: no .pub is private, with .pub is public — and the private one never leaves your computer.

Your next step

You can now recognize private and public keys in your own .ssh folder.

For the next 10 minutes: open your .ssh folder (if you already have one) and mentally classify each file as "private" or "public."

In the next lesson, you’ll fix the most common error people make when they copy a command from the wrong place — before creating your own key in lesson 6.

4"> [ {"front":"What's the difference between the key you keep and the one that goes to the VPS?","back":"The private key (without .pub) stays only on your computer; the public key (.pub) can be placed on the VPS, GitHub, etc."}, {"front":"Decision: you need to send your key in a message to a colleague so they can configure the VPS. Which file do you send?","back":"No private file—send only the .pub file, and even then, it's better for your colleague to generate their own key."}, {"front":"Why does it make sense to have one key for the VPS and another for GitHub instead of one key for everything?","back":"Because each key opens only the door it belongs to—if one leaks, the others stay secure."}, {"front":"Contrast: what's the difference between 'losing the public key' and 'losing the private key'?","back":"Losing the public key isn't serious (it's meant to be shared); losing the private key is serious because it's proof of identity."} ]

Track · Lesson 5

CMD or PowerShell?

By the end of this lesson, you’ll recognize which terminal you’re in and avoid the most common syntax mistake people make when copying a command from the wrong place.

Windows has two different terminals, and a command that works in one won’t work in the other. It’s the #1 cause of “I copied it exactly and it didn’t work”—we’ll fix this before creating your key, in lesson 6.

↓ scroll to study

01 Why Windows has two terminals

Windows comes with two different terminals: CMD (Command Prompt, older) and PowerShell (newer, with more features). They both open a similar-looking window, but they understand different syntax for some things—like how to refer to your user folder.

Marta opened CMD without realizing it because she searched for "prompt" in the Start menu — PowerShell appears when you search for "powershell." Neither one is "the wrong one"; they’re just different.

02 The error that comes up most often: mixing the syntax of the two

Ricardo was in CMD, at the path C:\Users\ricardo\projetos\testes>, and tried to run type $env:USERPROFILE\.ssh\id_ed25519.pub — a PowerShell command typed inside CMD.

Common error

Use $env:USERPROFILE inside CMD (or %USERPROFILE% inside PowerShell). The error looks something like “the filename syntax... is incorrect”—because $env:USERPROFILE is PowerShell syntax, and CMD doesn’t understand it.

03 The translation between the two

The rule is: in CMD, your user folder is written as %USERPROFILE%; in PowerShell, you write $env:USERPROFILE. It's the same place, just with a different "word" for each terminal.

Marta learned to check the window title or the prompt itself: if you see only a simple path like C:\Users\marta>, it's usually CMD; if you see PS C:\Users\marta> with “PS” at the beginning, it’s PowerShell.

04 Checklist before copying any command

From now on, every command that involves %USERPROFILE% or $env:USERPROFILE in this learning path indicates which of the two terminals it’s for—check before pasting. That was exactly the habit that kept Ricardo’s same mistake from happening again with Marta.

Quick checklist

  1. Look at the prompt: does it start with “PS”? That’s PowerShell. If not, it’s CMD.
  2. In CMD, use %USERPROFILE%.
  3. In PowerShell, use $env:USERPROFILE.
  4. Got a syntax error? Check that you’re in the right terminal for the command.

Practice now 0/2 done

Compare the two terminals in practice

Run the same request in both terminals, each with its own syntax — ~8 min.

We’re only listing a folder’s contents—neither command changes anything.

REM no CMD:
dir %USERPROFILE%\.ssh

# no PowerShell:
dir $env:USERPROFILE\.ssh

You’ve just learned to recognize, before typing, which syntax each terminal expects.

Summary

  • CMD and PowerShell are different terminals, with their own syntax for some things.
  • The most common mistake is using $env:USERPROFILE in CMD, or %USERPROFILE% in PowerShell.
  • Looking at the prompt (does it start with “PS” or not?) tells you which one you’re in.

Your next step

You can now identify which terminal you’re in before pasting a command.

For the next 10 minutes: open both terminals side by side and notice the difference in each prompt.

In the next lesson, you’ll use this exact precaution to create your own SSH key the right way for your terminal.

5"> [ {"front":"You're at a prompt that starts with 'PS C:\\Users\\...'. Which terminal is this?","back":"PowerShell—the 'PS' at the beginning is the clue."}, {"front":"Diagnosis: 'the filename syntax... is incorrect' appeared when you used $env:USERPROFILE. What probably happened?","back":"You typed the command in CMD, which doesn't understand the $env: syntax (that's PowerShell)."}, {"front":"Application: you're going to copy a command from a tutorial that uses %USERPROFILE%. Which terminal should you paste it into?","back":"CMD—%USERPROFILE% is CMD syntax, not PowerShell syntax."} ]

Track · Lesson 6

Creating your
own SSH key

By the end of this lesson, you’ll have your own SSH key, created by you, ready to be added to your VPS in the next lesson.

So far, you’ve only identified keys that already exist. Now it’s your turn to generate your first one — the step that frees you from typing a password every time you connect.

↓ scroll to study

01 Viewing an existing key

Before creating a new key, it’s worth seeing what a public key looks like: a long string of text that starts with ssh-ed25519. In CMD, type shows the contents of a text file.

Marta already has the key id_ed25519.pub from an old test; it runs type %USERPROFILE%\.ssh\id_ed25519.pub and see something like ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... minha-vps.

type %USERPROFILE%\.ssh\id_ed25519.pub

02 Opening the .ssh folder in File Explorer, if you’d rather see it

If you’d rather see the files as icons instead of text, the command explorer %USERPROFILE%\.ssh opens the folder in Windows Explorer, the same window you always use to view files.

Ricardo prefers this way: he types the command, Explorer opens, and he sees the files hostinger_vps e hostinger_vps.pub side by side, the way you’re already used to viewing folders.

Common error

Drag or copy the private key out of this folder "just to keep it somewhere easier to find." Any copy of the private key somewhere else (desktop, personal cloud storage) is one more copy that could leak — keep it only in there.

03 Creating the key, step by step

The type of key recommended today is ed25519 — more modern and secure. The creation command asks for a path and a name for your new key.

Marta chooses to call hers minha_vps, in CMD:

ssh-keygen -t ed25519 -C "minha-vps" -f %USERPROFILE%\.ssh\minha_vps

After that, just press Enter for the following prompts (they ask for an optional extra password for the key — you can leave it blank and confirm).

Test yourself

After running the command above, how many new files appear in the .ssh folder?

04 What the key generation creates

The command from the previous step creates two files: minha_vps (private key — never share it) and minha_vps.pub (public key — can go on the VPS).

Ricardo checks the two files in his folder and can already tell which is which, applying the rule from lesson 4: no .pub is private, with .pub is public.

Checking your new key

  1. Run the ssh-keygen with -f pointing to the chosen name.
  2. Press Enter at the following prompts.
  3. Check the 2 new files: one private, one .pub.

Practice now 0/2 done

Generate your own SSH key

Create a new key pair and choose your own name — ~10 min.

Creating a new key doesn’t delete any existing keys or change anything on your VPS — it just creates a new pair of files inside the .ssh folder. If you don’t like the name you chose, you can delete the 2 files and create them again.

ssh-keygen -t ed25519 -C "minha-vps" -f %USERPROFILE%\.ssh\<escolha um nome>

You just created your own SSH key—ready to log in to the VPS in the next lesson.

Summary

  • ssh-keygen -t ed25519 creates a new key pair with the name you choose.
  • Every time you create one, exactly 2 files are generated: the private key and the .pub, corresponding to it.
  • The private key should never leave the .ssh folder or be copied somewhere else "for convenience".

Your next step

You just created your own SSH key from scratch.

For the next 10 minutes: run type in the file .pub of the key you created, just to see what its contents look like.

In the next lesson, you’ll put this key on the VPS and connect without ever typing a password again.

6"> [ {"front":"Which command creates a new SSH key pair of the type currently recommended?","back":"ssh-keygen -t ed25519 -C \"comment\" -f path/key-name"}, {"front":"Diagnosis: you ran ssh-keygen and see only 1 file in the folder. What probably went wrong?","back":"The command didn't finish running (maybe it got stuck at one of the prompts)—it normally always generates 2 files."}, {"front":"Application: you want to keep a copy of the private key 'for safety' on a flash drive. Is that good practice?","back":"It's not recommended—each extra copy of the private key is another risk; create a new key if you need one somewhere else."} ]

Track · Lesson 7

Adding your key
in the VPS, step by step

By the end of this lesson, you’ll connect to your VPS using the key you created, without typing a password at all.

You already have the key (lesson 6). One step remains: give the VPS its public half so it can recognize it, then test it. This is the longest lesson in the learning path because it brings together everything that came before—take your time.

↓ scroll to study

01 Which key goes to the VPS

The rule is always the same: only the public key (the file .pub) travels to the VPS. The private key never leaves your computer — not even in this lesson.

Marta has already run ssh-keygen and has minha_vps e minha_vps.pub. She follows the steps below once, and the next time she needs to check the WhatsApp automation, she gets in without typing anything but the command. Ricardo follows the exact same sequence on the store's VPS, changing only the IP and key name.

02 Creating the right place inside the VPS

First, view your public key on your computer (type %USERPROFILE%\.ssh\minha_vps.pub) and copy the entire text. Then, log in to the VPS with a password (lesson 2) and create the folder and file that store the authorized keys inside it:

mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys

O nano is a simple text editor that opens inside the terminal itself. Paste the copied public key there, and save with CTRL+O, Enter, then CTRL+X to exit. That's how Ricardo pasted the store's public key into the VPS the first time he did this step.

Complete checklist: from the key on your PC to inside the VPS

  1. View and copy the public key on your computer.
  2. Log in to the VPS with a password.
  3. mkdir -p ~/.ssh — create the folder if it doesn’t exist yet.
  4. nano ~/.ssh/authorized_keys — paste the key and save (CTRL+O, Enter, CTRL+X).

03 Setting permissions

O permissions of the folder and file must be correct, or the VPS will ignore the key for security. Still inside the VPS, run:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Ricardo forgot this step on his first try, and his key simply didn’t work — with no clear error message. After adjusting the permissions, it worked on the first try.

Test yourself

If you skip the step for chmod, what is likely to happen when you try to connect with the key?

04 Testing the connection with the key

Type exit to exit the VPS, return to your computer and connect again — this time specifying which key to use, with -i:

ssh -i %USERPROFILE%\.ssh\minha_vps usuario@IP_DA_VPS

If everything is set up correctly, Marta gets right in—no password prompt. The key is all she needs.

Before

Every connection asked for a password, and you had to remember it or copy it from somewhere.

Then

The key proves who it is on its own — a faster, more secure connection, with no password at all.

Practice now 0/4 done

Add your key to the VPS and connect without a password

Follow the complete sequence, from your computer to the VPS recognizing your key — ~15 min.

You can always log in again with a password (lesson 2) if something gets stuck here—none of the steps in this exercise erase your existing password access.

type %USERPROFILE%\.ssh\minha_vps.pub
ssh usuario@IP_DA_VPS
mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
exit
ssh -i %USERPROFILE%\.ssh\minha_vps usuario@IP_DA_VPS

You can now log in to your VPS using only the key—the same workflow Marta and Ricardo use every day, without relying on tech support.

Summary

  • The public key is pasted into ~/.ssh/authorized_keys, on the VPS itself.
  • The permissions (chmod 700 in the folder, chmod 600 in the file) are required—without them, the VPS ignores the key.
  • Connect with -i pointing to the key removes the need to enter a password.

Your next step

You can now log in to your VPS using only your key, without a password.

Over the next 15 minutes: close the terminal, open a fresh one, and connect again with -i, just to confirm that it works consistently.

In the next lesson, you’ll make this command even shorter by giving your VPS a nickname.

7"> [ {"front":"Application: you just generated a new key (lesson 6). What are the 4 steps, in order, to make it work with your VPS?","back":"Copy the .pub file, paste it into ~/.ssh/authorized_keys (using nano), set chmod 700/600, and test with ssh -i."}, {"front":"Diagnosis: you did everything right, but when you connect with -i, the VPS still asks for a password. What should you check first?","back":"Check chmod: a folder or file with overly open permissions is the most common cause of this specific symptom."} ]

Track · Lesson 8

Shortcuts with
the file config

By the end of this lesson, you’ll connect to your VPS by typing just a nickname, without repeating the IP, username, and key path every time.

The command from lesson 7 works, but it’s long to repeat every day. A 4-line file takes care of that for good.

↓ scroll to study

01 The problem with always repeating the same thing

Every day, to access the VPS with the key, you have to remember (or copy from somewhere) a whole command: username, IP, and key path. It’s easy to mistype a character along the way.

Ricardo kept the full command written down in a notepad, just to paste it whenever he needed it — it worked, but it was an unnecessary extra step.

02 Creating the config file

On your computer, inside the folder .ssh, you can create a file named exactly config (with no extension), with a block similar to this:

Host hostinger
    HostName 123.123.123.123
    User root
    IdentityFile ~/.ssh/minha_vps

Marta creates hers with the nickname salao, replacing the IP and username with the ones for her own VPS.

Common error

Forgetting the indentation (spaces) before each line after “Host”. The config file follows a format where the lines below “Host” need to be indented—without that, connecting with the nickname won’t work.

03 What each line in the file means

Host is the nickname you choose (the name you’ll type). HostName is the VPS’s real IP address. User is the user. IdentityFile points to the private key that should be used.

Test yourself

In Ricardo’s example, which line does he need to change to point to the key he created in lesson 6?

04 Connecting using only the nickname

After saving the file, the connection command becomes just: ssh hostinger — instead of typing the username, IP, and key path every time. Marta does this in seconds today, in the middle of a busy day with clients at the salon.

Shortcut checklist

  1. Create (or open) the file config inside the folder .ssh.
  2. Write the block Host / HostName / User / IdentityFile, indented.
  3. Save and test with ssh <apelido escolhido>.

Practice now 0/2 done

Create your own connection shortcut

Write the config file and connect using just the nickname — ~8 min.

The config file only affects your computer, not the VPS—if you get something wrong, just reopen it and fix it, with no risk of locking up the server.

Host <escolha um apelido>
    HostName IP_DA_SUA_VPS
    User <seu usuario>
    IdentityFile ~/.ssh/minha_vps

You just reduced the entire connection process to a single word—your nickname.

Summary

  • The file config, inside the .ssh folder, stores connection nicknames.
  • Each block has 4 lines: Host (nickname), HostName (IP), User e IdentityFile (key).
  • Once it’s created, connecting is just ssh <apelido>.

Your next step

You just reduced your daily connection to a single word.

Over the next 5 minutes: test your nickname from a terminal you close and reopen to confirm it stays saved.

In the last lesson, you’ll learn how to diagnose the most common errors — in case something doesn’t go as expected.

8"> [ {"front":"What are the 4 lines that make up a block in the config file?","back":"Host (nickname), HostName (IP), User (username), and IdentityFile (key path)."}, {"front":"Diagnosis: you created the config correctly, but ssh nickname says it doesn't recognize the host. What should you check first?","back":"The indentation (spaces) on the lines below Host—without the correct indentation, the file isn't read as expected."}, {"front":"Application: you have 2 different VPSs. How does the config file handle this?","back":"Just create 2 different Host blocks, one nickname for each, each with its own HostName/User/IdentityFile."} ]

Track · Lesson 9

Solving the
most common errors common

By the end of this lesson, you’ll diagnose the 4 most common connection errors on your own and know what action to take for each one.

At some point, a connection will fail — that’s normal and doesn’t mean you’ve done something fundamentally wrong. What makes all the difference is recognizing the message and knowing where to start investigating.

↓ scroll to study

01 Reading the error message is the first step

SSH always returns a message when something fails—and that message already points you in the right direction for troubleshooting. The 4 most common ones are: Permission denied, Connection timed out, Connection refused, and an error saying the "fingerprint" had changed.

Marta, the first time she saw Permission denied, thought he had broken something. He hadn't: he'd just typed the wrong username.

02 "Permission denied"

This message means the connection reached the VPS, but authentication failed. The most common causes are: wrong password, wrong user, wrong key, or the public key wasn’t added to authorized_keys, or the folder permissions .ssh are wrong (lesson 7). That was exactly the message Marta saw on her first attempt, because she typed the wrong username.

Common error

"Permission denied" when trying to connect to -i using the key. Before suspecting the key itself, check: the file authorized_keys has exactly the right key pasted in, and the permissions are set to 700/600.

03 "Connection timed out," "Connection refused," and an old key

Connection timed out means the request never got a response — usually the IP is wrong, the VPS is turned off, or a port is blocked by a firewall. Connection refused means the VPS responded with "no" — the SSH service may be turned off on it, or the port being used is wrong.

Ricardo recreated the store’s VPS once, and when he tried to connect again, he got a warning that the server’s “fingerprint” had changed — the command ssh-keygen -R IP_DA_VPS clears the old saved signature and lets you connect again, accepting the new one.

04 Checking the SSH service directly on the VPS

If you’re already on the VPS (for example, by logging in with a password after a key failure), systemctl status ssh (or sshd, depending on the system) shows whether the service is active. Ricardo used this command when the store's post automation stopped responding, and confirmed that the service was running — the problem was something else.

systemctl status ssh
sudo systemctl enable ssh
sudo systemctl start ssh

Final checklist: from scratch to connecting with a key

  1. Check for/install SSH on your computer (Lesson 2).
  2. Connect with a password at least once (lesson 2).
  3. Create your key (lesson 6) and add it to the VPS (lesson 7).
  4. Create the shortcut in config (lesson 8).
  5. If something fails: read the error message and use this checklist of possible causes.

Practice now 0/2 done

Diagnose 2 real cases

Read the 2 mini cases and identify the most likely cause of each — ~8 min.

This is only reading and reasoning — no real VPS is touched in this exercise.

Case 1. Marta tries to connect with ssh -i ~/.ssh/minha_vps admin@45.77.12.9 and receives Permission denied. She confirms that the IP and username are correct.

Case 2. Ricardo tries to connect to the store’s VPS, and the terminal sits idle for a minute until Connection timed out. He confirms in another service's browser that the VPS is online.

view the explained answer key

Case 1: since the IP and username have already been confirmed, the most likely cause is that the public key wasn’t pasted correctly into authorized_keys, or the folder permissions .ssh/file to be wrong—the same diagnosis as step 2 of this lesson. Case 2: "timed out" (no response at all) points to a network problem before the connection even reaches SSH — a firewall blocking the port is the most common cause when the VPS is confirmed to be on.

You can now diagnose connection problems from the error message, without relying on anyone else to understand what’s going on.

Summary

  • Every SSH failure comes with a message—it already points you in the right direction for troubleshooting.
  • "Permission denied" is an authentication problem; "timed out"/"refused" indicate a network problem or a service that's turned off.
  • systemctl status ssh, directly on the VPS, confirms whether the service is active.

Your next step

You just completed the entire learning path: today you can connect, understand keys, create your own, put it on the VPS, create shortcuts, and diagnose errors—all by yourself.

Over the next 15 minutes: choose one of your automations running on a VPS and connect to it using the nickname in the config, just to confirm that the whole flow works from start to finish.

Next time something gets stuck on your VPS, you’ll know where to start — without waiting for someone to be available.

9"> [ {"front":"Diagnosis: you get Connection refused when trying to connect. What does this indicate, unlike a timed out error?","back":"The VPS responded by refusing the connection (e.g., the SSH service is off or the port is wrong)—a timed out error means there's no response at all."}, {"front":"Application: your VPS was recreated, and now you see a warning that the server's fingerprint has changed. What should you do?","back":"Run ssh-keygen -R IP_DA_VPS to clear the old fingerprint, then try connecting again and accept the new one."}, {"front":"Decision: you get Permission denied even though the IP and username are confirmed correct. Where should you start investigating?","back":"Check authorized_keys (is the key pasted correctly?) and the permissions on the .ssh folder (700) and file (600)."} ]