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

ssh connects to a remote computer over an encrypted connection, opens an interactive shell, or runs a command there. The basic form is ssh [options] [user@]hostname [remote-command]. Replace example usernames, hostnames, ports, key paths, and commands below with the values for your systems.

SSH command syntax

The OpenBSD ssh(1) manual describes SSH as a client for secure, encrypted communication between two untrusted hosts over an insecure network. A destination is usually a hostname, optionally preceded by a username. You can also supply a command after the destination; SSH runs it on the remote host instead of starting an interactive login shell.

These are syntax examples based on the manual, not tested sessions. Your computer needs an SSH client, and the remote machine must accept SSH connections for the account and address you use.

Common SSH command examples

Task Command What to replace or expect
Connect using your current local username ssh host.example.com Replace host.example.com with the server hostname or IP address. SSH uses your local username unless you specify another.
Connect as a named user ssh user@host.example.com Replace user and host.example.com with the remote account and host.
Run one remote command ssh user@host.example.com 'uname -a' Replace the quoted command with the command to run remotely. The quote keeps the shell from treating it as a local command.
Use a non-default port ssh -p 2222 user@host.example.com Replace 2222 with the port configured for the SSH server.
Select a private key file ssh -i ~/.ssh/id_ed25519 user@host.example.com Replace the key path with the private key file you intend to use.
Connect through a jump host ssh -J user@jump.example.com user@internal.example.com Replace both user/host pairs. The first is the jump host; the second is the destination reached through it.
Show connection diagnostics ssh -v user@host.example.com Add more v characters, up to three, for progressively more verbose output.

Useful SSH options

Option Purpose
-p port Connect to the specified remote port instead of the default.
-i identity_file Choose a private-key identity file.
-J destination Connect through a jump host before reaching the destination.
-v, -vv, -vvv Print increasingly detailed diagnostic output.
-L Set up local port or socket forwarding.
-R Set up remote port or socket forwarding.
-D Create a local SOCKS proxy endpoint for dynamic forwarding.
-N Do not run a remote command; useful when the connection is only for forwarding.
-A Enable authentication-agent forwarding. Use only when you understand the access it grants on the remote host.
-X, -Y Enable untrusted or trusted X11 forwarding, respectively; both have security implications.

Option availability and behavior can vary across SSH implementations. Consult your installed client’s manual if it differs from the OpenBSD reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.

SSH port forwarding: choose by traffic direction

Forwarding creates a listener at one end of an SSH connection and carries connections through the encrypted channel to another destination. Pick the option based on where the listener should be and which side can reach the destination.

Mode Where it listens Where connections go Typical use
Local: -L On the SSH client side To a specified host and port (or socket) reachable from the remote side Reach a service on a remote network through the SSH server.
Remote: -R On the SSH server side Back to a specified host and port (or socket) reachable from the local side Make a locally reachable service available through a listener on the remote side.
Dynamic: -D On the SSH client side To destinations selected by applications using the local SOCKS4/SOCKS5 proxy Route supported application traffic through an SSH connection.

For TCP remote forwarding, the remote listener is loopback-only by default. Binding it to a broader address changes who may be able to connect, and whether that is permitted also depends on server configuration. Avoid exposing a forwarded listener beyond the intended audience.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

Forwarding-only sessions

Add -N when you want the SSH connection to carry forwarded traffic without opening a remote shell or running a command. For example, the general shape is ssh -N -L local_port:destination_host:destination_port user@host.example.com. Replace each placeholder with the local listening port, a destination reachable from the remote side, its port, and the SSH account and host. The listener is on your client; this is not the shape for a listener on the server.

Save repeated settings in SSH configuration

The OpenBSD ssh_config(5) manual documents per-user and system-wide client configuration. Its documented default client port is 22. A per-user file at ~/.ssh/config can store settings for matching host patterns so you do not need to repeat them on every command.

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.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.

For example, a host entry can take this form:

Host myserver
    HostName host.example.com
    User user
    Port 2222
    IdentityFile ~/.ssh/id_ed25519

After saving an entry like this, connect using its alias with ssh myserver. Replace the example values with your account, host, port, and key path. Configuration uses host patterns and option-ordering rules; read the current manual before relying on overlapping entries or assuming a setting applies to every host.

Security cautions for agent and X11 forwarding

Authentication-agent forwarding

With -A, the remote host can use your forwarded local authentication agent to request authentication operations. The OpenBSD ssh(1) manual warns that a user on the remote host who can bypass the relevant socket permissions may use identities loaded in your agent. Prefer a jump host when it meets the connection need, and avoid agent forwarding to machines you do not trust.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

X11 forwarding

-X requests untrusted X11 forwarding; -Y requests trusted X11 forwarding. X11 forwarding can expose your local display to a remote user able to bypass relevant file permissions. The manual also notes that trusted forwarding is not subject to the X11 SECURITY extension restrictions. Enable it only when needed and when you trust the remote host.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot a connection with verbose output

  1. Retry with ssh -v user@host.example.com, substituting the correct account and host. The client prints diagnostic information that can help identify where the connection is failing.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    Best Value
    Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
    • 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.
  2. If the output is not detailed enough, increase verbosity to -vv or -vvv. The OpenBSD manual documents progressively more verbose diagnostics up to three v characters.

  3. Check the command values you supplied: username, hostname, port, and identity-file path. If connecting through a jump host, verify each destination in the -J chain.

  4. Before sharing diagnostic output publicly, review it for sensitive hostnames, account names, addresses, or other details you do not want exposed.

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.

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