Log Into a Remote Machine with ssh on macOS

Use the built-in ssh client to open a secure shell on another Mac, Linux box or server.

macOSmacosnetworkTerminalcliMedium risk
Run `ssh admin@192.168.1.20` (add `-p 2222` for a non-standard port), accept the host key on first connect, and enter the remote password.

01Command

Command
$ ssh admin@192.168.1.20

02What it does

macOS ships the OpenSSH client, so no installation is needed: `ssh user@host` opens an encrypted shell where every command runs on the remote machine. The destination syntax user@hostname covers IP addresses, hostnames or entries from ~/.ssh/config; -p selects a custom port. To be reachable yourself, enable Remote Login on the target Mac (System Settings > General > Sharing) — the same service the ssh client connects to. Keypairs can replace passwords; see ssh-keygen and ssh-add tools.

03Risk

RiskMedium risk
RequirementsTarget host must have Remote Login / sshd running; first connection asks to confirm the host key.
!Warning: Only connect to machines you are authorized to use; each host key you accept is stored in ~/.ssh/known_hosts.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • ssh(1) man page
    Xcode Man Pages (keith.github.io) · technical · 2026-09-17
    Evidence: Man page for ssh: 'ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec] … [-p port] destination [command]' with destination in user@hostname form.
  • ssh(1) - OpenSSH remote login client
    ManPagez · technical · 2026-09-17
    Evidence: Mirrors the ssh man page: ssh (SSH client) is a program for logging into a remote machine and executing commands, connecting as user@hostname.

Last verified: 2026-09-19 · Category: Network

06Related solutions