Oracle Cloud SSH Connection Refused – Stuck While Installing n8n
Hi all, I’m working on a personal automation project using Oracle Cloud (Free Tier) to self-host n8n, but I’m currently stuck at the SSH connection stage.
Current Setup
- Oracle Cloud Free Tier
- VM instances created:
- Ubuntu:
Canonical-Ubuntu-XX
- Oracle Linux:
Oracle-Linux-9.0-2025.0721-01
(tried later)
- Public IP assigned and visible
- Trying to SSH using a
.pem
key
The Problem
- Getting
Connection refused
when attempting to SSH
- Security List: Ingress rule for
0.0.0.0/0
, TCP port 22
is open
- Internet Gateway + Route Table: confirmed and configured
- Key permissions: set via
chmod 400
- SSH command used:
ssh -i my-key.pem ubuntu@ IP
Hey @Motorboy_Shin hope all is good. Welcome to the community.
There could be a number of reasons for connection refused error, let’s go over a few possible scenarios.
- Can you connect to the VM from elsewhere with the same key?
- Verify that SSH is actually running on that VM (systemctl)
- Verify that SSH is listening on port 22 (netstat or ss)
- Verify TCP connection with
nc -vz <PUBLIC_IP> 22
- Verify that the VM doesn’t impose its own firewall rules (ip_tables or ufw)
- Verify that the traffic is reaching the VM (tcpdump or ssh debug)
- Verify:
- public subnet + public ip
- security List or NSG rules
- you are using the correct public ip
(you’d be surprised)
- user is allowed to ssh into system
- sshd configuration allows key based access
Quite a few things that can go wrong, as you can see.