Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Connect to Your VPS via SSH on macOS (Step-by-Step)

Use macOS Terminal’s built-in SSH client to connect to your VPS, verify its host fingerprint, authenticate with a password or key, and troubleshoot common connection errors.
Length12 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To SSH into a VPS from a Mac, open Terminal and run ssh username@VPS_IP. Replace username with the account supplied by your VPS provider and VPS_IP with the server’s public IPv4 address or hostname. macOS already includes an OpenSSH client, so the basic connection does not require another application. You will then verify the server fingerprint and authenticate with either a password or a private key.

This guide explains the complete first connection, non-standard ports, key-based login, provider console recovery, and the exact steps to diagnose timeouts, refusals, authentication failures, and host-key warnings.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What you need before opening Terminal

SSH cannot discover your VPS or credentials for you. Obtain these details from the VPS dashboard, provisioning email, or administrator:

  • Public address: the VPS public IPv4 address or a hostname that resolves to it.
  • SSH username: the account initially created by the provider or administrator. Do not assume it is root; many images create a different administrative user.
  • Authentication method: either the provider-issued password or the private key matching a public key installed on the server.
  • SSH port: port 22 is common, but a provider can configure another port. Use the documented value rather than guessing.

Some providers also expose a browser-based out-of-band console. That console is useful when the network SSH service is unavailable, when you need to repair an account, or when you must inspect the daemon from inside the VPS. It is a recovery path, not a substitute for knowing the normal SSH address and credentials.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

How do I SSH into my VPS from a Mac?

macOS includes Terminal and the OpenSSH client. The shortest working command is:

ssh username@VPS_IP

For example, if your provider gives you the user alex and the address 203.0.113.20, type:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ssh [email protected]

Press Return. On a first connection, SSH normally displays the server’s host-key fingerprint and asks whether you want to continue. Verify that fingerprint with the provider or administrator when possible. Only answer yes when the displayed identity is expected. SSH stores the accepted host key in your Mac’s known_hosts file so it can detect an unexpected change later.

After the identity check, SSH asks for the account password if password authentication is enabled. Password characters deliberately do not appear while you type in Terminal; this is normal. A successful login ends at a remote shell prompt. You are now operating on the VPS, not on your Mac.

Step-by-step: connect through Terminal

1. Copy the exact address and account name

Copy the address from the provider dashboard rather than retyping it. Check for transposed digits, an omitted IPv6 bracket (if your provider supplied an IPv6 address), or a hostname belonging to a different server. Keep the username exactly as issued, including capitalization where the operating system treats names distinctly.

2. Open Terminal

Open Finder’s Applications folder, then Utilities, and launch Terminal. You can also press Command-Space, type Terminal, and press Return. No separate SSH client installation is required for this workflow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Run the standard command

ssh username@VPS_IP

The hostname position accepts either an IP address or a domain name. Do not include a web URL such as https://, a trailing slash, or a dashboard path. SSH needs only the host portion.

4. Read the first fingerprint prompt

A first connection commonly shows a message that the authenticity of the host cannot be established, followed by a key type and fingerprint. This is a server-identity check, not a password request. Compare the fingerprint with a value published by your provider or given by your administrator through a trusted channel.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

If it matches, enter yes and press Return. SSH records the host key locally. If you cannot verify it, stop and obtain confirmation before accepting it. Accepting an unknown key defeats an important part of SSH’s protection against connecting to the wrong machine.

5. Authenticate

For password login, type the password and press Return. Terminal will remain visually blank while you type. A rejected password returns an authentication error; it does not indicate that the network connection failed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For key login, SSH uses a key that is already loaded or located in a standard key-file location. If your private key has a different filename or location, specify it with -i:

ssh -i /path/to/private_key username@VPS_IP

When the private key is protected by a passphrase, SSH asks for that passphrase locally. The passphrase unlocks your private key; it is not sent to the VPS as the account password.

6. Confirm that you reached the remote shell

The prompt usually changes to a form that identifies the remote user and host. To make the distinction unmistakable, run a harmless command such as:

hostname

The returned name is the VPS host name. You can also run whoami to confirm which account authenticated. Avoid making configuration changes until these checks show the expected server and user.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

7. End the session safely

When finished, run:

logout

You can also press Control-D. This closes the remote shell and returns you to your Mac’s local prompt. Closing the Terminal window also ends the session, but logout makes the action explicit.

How to connect when the VPS uses a custom SSH port

Port 22 is a common default, not a universal rule. If your provider or administrator specifies another port, add -p followed by that number:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
ssh -p PORT username@VPS_IP

For a server using port 2222, the command would be:

ssh -p 2222 [email protected]

Use the same port for key and password login. A correct address with the wrong port can look like a server outage: the client may time out or receive a refusal even though the VPS is running. Do not infer the port from a security tutorial or from another server; check the value assigned to this VPS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If you connect frequently, you can place the host, user, port, and key path in ~/.ssh/config and then use a short alias. Protect that file as you would any account information. The one-off -p command remains useful for testing because it makes the selected port visible.

Password login versus SSH-key login

Both methods can establish an encrypted SSH session, but they have different setup and maintenance requirements.

Consideration Password SSH key
Initial setup Use the password supplied or reset by the provider. Generate a key pair and install the public key in the target account.
Repeat logins Type the account password each time password authentication is requested. Use the matching private key, optionally unlocking it with a local passphrase.
Exposure to guessing Depends on password strength, account controls, and whether password authentication remains enabled. The server verifies possession of the private key; the private key itself never leaves your Mac.
Recovery A provider reset or console session may restore access. A second authorized key or provider console is needed if the only private key is lost.
Best fit One-time setup, emergency access, or an environment that requires passwords. Regular administration, automation, and accounts where the provider supports key authentication.

For routine administration, a key protected by a strong passphrase avoids repeatedly sending a password-authentication request while preserving local protection if someone obtains the key file. Keep the private key secret and never place it in source control, a shared folder, or a support ticket.

How to set up an SSH key on macOS

1. Generate an Ed25519 key pair

If you do not already have a suitable key, run:

ssh-keygen -t ed25519

When prompted for a file location, press Return to accept the displayed default or provide a dedicated filename. Enter a passphrase when asked. The command creates a private key and a public key ending in .pub. The private key is the credential; the public key is the value that belongs on the VPS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Install the public key on the VPS account

The public key must be appended to the target account’s ~/.ssh/authorized_keys file. Providers commonly offer a key field during provisioning or an account-panel installation option. If the VPS is already reachable with a password, you can use a one-time password session to place the public key. The utility ssh-copy-id can perform this where it is available, but it is not present in every macOS installation, so follow the provider’s documented method when the command is missing.

Install the key for the same username you will use in the SSH command. A key added to one account does not automatically authorize another account. On the server, the .ssh directory and authorized_keys file must be owned by the account and protected from inappropriate write access; incorrect ownership or permissions can cause the server to ignore an otherwise valid key.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

3. Test in a new session

Open a new Terminal tab and run:

ssh username@VPS_IP

If the private key is not in a standard location or has a custom name, use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ssh -i /path/to/private_key username@VPS_IP

Do not delete your working password access until the key has been tested successfully. Keeping a second recovery method during setup prevents a typo in authorized_keys from locking you out.

4. Diagnose a key that is being ignored

Verbose mode shows which keys the client offers and how the server responds:

ssh -v username@VPS_IP

Use the custom port and identity options with verbose mode when applicable:

ssh -v -p PORT -i /path/to/private_key username@VPS_IP

Look for the username, selected address and port, identity-file path, and the point where the server rejects or accepts the key. Verbose output can contain identifying details; share it only with people you trust and redact addresses or usernames when posting it publicly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What to do when SSH says “Connection timed out”

A timeout means the client did not complete a connection to the selected address and port within the allowed period. Work through network and endpoint checks in this order:

  1. Confirm the VPS address in the dashboard. An old address may belong to a previous instance or may have been reassigned.
  2. Confirm the SSH port. Test the documented custom port rather than assuming 22.
  3. Check the VPS state. A machine that is stopped, still provisioning, or undergoing a provider operation may not accept connections yet.
  4. Check your Mac’s network route. Temporarily disconnect from a VPN or restrictive network and try a known working connection, if permitted by your organization.
  5. Review local firewall or security software that could block outbound connections.
  6. Use the provider’s browser console or status information to verify that the SSH daemon is running and that the server firewall allows the selected port.

Do not repeatedly change credentials while the client cannot reach the server. Authentication has not started until a network connection and SSH protocol exchange succeed.

What to do when SSH says “Connection refused”

A refusal usually means the address responded but no service accepted the connection on that port. The VPS may still be booting, the SSH daemon may be stopped, or a firewall may reject the selected port.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
  • Check whether the VPS has finished provisioning and is powered on.
  • Recheck the port with ssh -p PORT username@VPS_IP.
  • Open the provider console and inspect the SSH service and server firewall.
  • Confirm that the address points to the intended VPS, especially after rebuilding or moving an instance.

A refusal is different from a bad password. Fix reachability and service status first; only then troubleshoot authentication.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What to do when SSH says “Permission denied (publickey)”

This message means the server did not accept any public key offered for the selected account. Check each part of the identity chain:

  1. Verify the username. The public key may be installed under a different account.
  2. Verify the private-key path with -i, and confirm that the file is the private half of the pair rather than the .pub file.
  3. Compare the public key on your Mac with the line in the server account’s ~/.ssh/authorized_keys.
  4. Check ownership and permissions on ~/.ssh and authorized_keys. Overly broad write access can make the SSH daemon reject them.
  5. Run ssh -v to confirm that the intended key is offered and to see whether the server refuses it.
  6. Use the provider console or a temporary password login to repair the file if no authorized method remains.

If the server asks for a password after a key attempt, that may indicate that key authentication failed and the server is falling back to password authentication. Verbose output distinguishes that fallback from a successful key login.

How to handle a host-key or man-in-the-middle warning

SSH stores a fingerprint for each host it accepts. If a later connection presents a different key, SSH warns that the host identification has changed. Treat this as a security event until you know why it happened.

Legitimate explanations include rebuilding the VPS, reinstalling its operating system, changing the server behind a hostname, or assigning the address to a different instance. An attacker intercepting the connection is another possibility. Contact the provider or administrator through a trusted channel and compare the new fingerprint with the expected value.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not blindly remove the entry from known_hosts merely to silence the warning. Once the change is verified, remove or update only the affected host entry using the method recommended by your administrator, then reconnect and verify the replacement fingerprint.

Provider connection methods and what varies

The exact first-login experience depends on how the VPS was created. Use the dashboard’s instructions for the instance rather than assuming another provider’s defaults.

Connection detail What may vary What you should confirm
Port 22 may be used, or the administrator may choose another port. Exact numeric port and whether a firewall permits it.
Initial user Some images create a named administrative user; others provide a different initial account. Username to place before the @ sign.
Key injection A public key may be installed during provisioning, or you may start with a password. Whether your public key is already attached to this instance.
Web console Some dashboards provide an out-of-band console; availability and controls differ. How to open it for recovery if network SSH fails.
Password handling A temporary password may be shown once, reset through the dashboard, or disabled in favor of keys. Where to retrieve or reset it and whether password login is enabled.

These differences explain why a command copied from a different VPS can fail even when the operating system appears similar. The address, username, port, and installed key all belong to a particular instance.

Security practices for a VPS you administer from macOS

SSH provides encrypted commands in transit, but secure transport does not make every account or server configuration safe. Apple describes SSH as a way to send secure, encrypted commands to a server over a network. Host-key verification adds a separate identity check so encryption is not quietly established with an unexpected machine.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Prefer a non-root daily account: use an ordinary administrative account and sudo when the provider and operating system support it. Reserve direct root access for tasks that genuinely require it.
  • Protect private keys: keep them outside shared folders and repositories, use a passphrase, and restrict access to your macOS account.
  • Verify fingerprints: check the first fingerprint and investigate later changes instead of accepting every prompt automatically.
  • Keep a recovery path: retain a second authorized key or know how to reach the provider console before changing authentication settings.
  • Record instance-specific details: store the correct hostname, port, username, and key alias in a secure place so you do not guess during an outage.
  • Separate environments: use distinct keys or aliases for unrelated servers when practical, limiting the impact of a lost credential.

A compact first-connection checklist

  1. Copy the VPS public address or hostname.
  2. Copy the exact SSH username.
  3. Confirm whether authentication uses a password or a named private key.
  4. Confirm the SSH port; use 22 only when the provider documents it or confirms it.
  5. Open macOS Terminal.
  6. Run ssh username@VPS_IP, adding -p PORT and -i /path/to/private_key when required.
  7. Verify the first host-key fingerprint before entering credentials.
  8. Authenticate and confirm the remote identity with hostname or whoami.
  9. Exit with logout or Control-D.

When to use the provider’s browser console instead

Use the out-of-band console when SSH cannot reach the VPS, the daemon is stopped, the firewall blocks the port, the account’s authorized_keys file is damaged, or you need to reset a credential. Because the console operates through the provider rather than your VPS’s SSH listener, it can remain available during a network-configuration mistake.

Once inside the console, verify the server’s address, service status, firewall rules, account name, and key-file permissions. Make one corrective change at a time, then close the console and retest from Terminal with the documented address and port.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.