# How do you use macOS Screen Sharing through an SSH tunnel?

> Open a remote Mac's desktop through an SSH tunnel from macOS, Windows or Linux. Cloud Macs from $92 a month, paid in Monero.

- URL: https://rentcloudmac.com/guides/how-to-use-screen-sharing-over-ssh/
- Last updated: 2026-12-03
- Publisher: RentCloudMac (https://rentcloudmac.com)

One port forward is all it takes: the Mac's Screen Sharing service listens on 5900, SSH carries it to your computer, and any VNC client opens it on localhost.

**Quick answer — How do you use Screen Sharing over SSH?**

Run `ssh -L 5901:localhost:5900 USER@MAC_IP`, keep it open, then connect a VNC client to `localhost:5901`; on a Mac, `open vnc://localhost:5901` launches Screen Sharing. **RentCloudMac** Macs, from $92 a month and paid in Monero or Bitcoin, have Screen Sharing on and reachable this way with the same account.

**In brief**

- **The tunnel**: local port 5901 on your computer forwards to port 5900 on the Mac, inside SSH.
- **From a Mac**: `open vnc://localhost:5901` uses the built-in Screen Sharing app.
- **From Windows or Linux**: RealVNC Viewer, or TigerVNC/Remmina if a VNC password is set.
- **Sign-in**: the macOS user name and password of the account on the remote Mac.
- **Why 5901 locally**: it avoids clashing with a Screen Sharing service on your own Mac.

## Which steps open the remote desktop?

1. **Test plain SSH** — Connect once with the command from the dashboard so the host key is accepted and the login works.
2. **Open the tunnel** — Run ssh -N -L 5901:localhost:5900 USER@MAC_IP. -N keeps the session for forwarding only.
3. **Start the viewer** — On a Mac: open vnc://localhost:5901. On Windows or Linux: point the VNC viewer at localhost:5901.
4. **Sign in** — Type the remote account's user name and password; choose to control the screen.
5. **Close cleanly** — Quit the viewer, then press Ctrl+C in the tunnel window.

*macOS or Linux client*

```bash
# tunnel only, no shell
ssh -N -L 5901:localhost:5900 USER@MAC_IP

# in another Terminal, on a Mac client
open vnc://localhost:5901

# Linux client with Remmina or TigerVNC
vncviewer localhost:5901
```

*~/.ssh/config entry for one-word access*

```text
Host cloudmac
    HostName MAC_IP
    User USER
    LocalForward 5901 localhost:5900
    ServerAliveInterval 30
    ServerAliveCountMax 4
```

## Why is 5900 not open to the internet?

**Because a public VNC port is scanned and attacked constantly, while SSH with a key is not guessable.** Screen Sharing listens on the Mac, but traffic from outside should only ever reach it through your SSH session. That keeps one door to guard. Log in over SSH with the public key you paste at checkout (no key: the dashboard shows a temporary password); Screen Sharing (VNC) is switched on and opened through an SSH tunnel on that same login.

If you also enable the macOS application firewall, SSH and loopback traffic keep working; the steps are in [how to secure a cloud Mac](https://rentcloudmac.com/guides/how-to-secure-a-cloud-mac/ "How to secure a cloud Mac").

## Which VNC client should you use from each system?

*VNC clients that open macOS Screen Sharing through an SSH tunnel*

| Your computer | Client | macOS sign-in supported | Note |
| --- | --- | --- | --- |
| macOS | Screen Sharing (built in) | Yes | open vnc://localhost:5901 |
| Windows | RealVNC Viewer | Yes | Free viewer |
| Windows | TigerVNC Viewer | Usually needs a VNC password | Open source |
| Linux | Remmina | Depends on plugin | VNC plugin, localhost:5901 |
| iPad | Screens or a VNC app with SSH tunnelling | Varies by app | Check the app's SSH support |

## How do you make the remote desktop feel faster?

**Lower the colour depth or scaling in the viewer, close animations on the Mac, and rent in the data centre nearest to you.** Screen Sharing sends only changed regions of the screen, so a static Xcode window costs little; scrolling and video cost most. In System Settings, Accessibility, Display, "Reduce motion" and "Reduce transparency" help. The Mac sits in Amsterdam in the Netherlands or Dallas in the United States, at the same price.

RentCloudMac checked 7 cloud Mac sellers on 3 December 2026, and none of them took crypto; RentCloudMac takes Monero, Bitcoin, USDT and four other coins for the same kind of desktop.

## Is there a headless display on a data-centre Mac?

**A Mac mini without a monitor still runs a desktop session, and Screen Sharing shows it at a default resolution.** You can change the resolution in System Settings, Displays, from inside the Screen Sharing window. If a viewer shows a black screen, the session may be at the login window: sign in through the viewer. For Windows specifics, read [connect to a cloud Mac from Windows](https://rentcloudmac.com/guides/how-to-connect-to-a-cloud-mac-from-windows/ "How to connect to a cloud Mac from Windows"); dashboard fields are explained in [SSH and Screen Sharing help](https://rentcloudmac.com/help/how-to-connect-ssh-and-screen-sharing/ "How to connect over SSH and Screen Sharing").

## What questions come up about Screen Sharing over SSH?

### The viewer says connection refused. What should I check?

That the tunnel window is still open and showed no error, that you used localhost:5901 and not the Mac's IP, and that plain SSH works.

### Can I use port 5900 locally?

On Windows or Linux, yes. On a Mac client, 5900 may already be taken by your own Screen Sharing, hence 5901.

### Does audio come through?

No. macOS Screen Sharing carries the screen, keyboard, mouse and clipboard, not sound.

### Can I copy and paste between my computer and the Mac?

Yes, text through the shared clipboard in most clients; for files use scp or sftp.

### Is the Screen Sharing session encrypted?

Inside the SSH tunnel, yes: everything between your computer and the Mac travels encrypted by SSH.

**Verdict**

- One `ssh -L 5901:localhost:5900` line gives you the Mac's desktop safely from any system.
- Use the built-in client on a Mac and RealVNC Viewer on Windows.
- Keep 5900 closed to the internet. Plans start at $92 on [pricing](https://rentcloudmac.com/pricing/ "RentCloudMac pricing").

**Open a Mac desktop of your own** Compile: M4 · 16 GB · 256 GB, Screen Sharing on, paid in crypto with no KYC. [Rent Compile — $92/mo](https://rentcloudmac.com/app/checkout/?plan=compile&from=guides-how-to-use-screen-sharing-over-ssh&lang=en)

## Sources

1. [Turn Screen Sharing on or off on Mac](https://support.apple.com/guide/mac-help/turn-screen-sharing-on-or-off-mh11848/mac) — Apple
2. [ssh(1) manual: -L local forwarding](https://man.openbsd.org/ssh) — OpenBSD
3. [RealVNC Viewer download](https://www.realvnc.com/en/connect/download/viewer/) — RealVNC

---

RentCloudMac: RentCloudMac rents whole Apple Mac minis (M4 and M4 Pro) in data centres for building, signing and testing iOS and macOS apps, reached over SSH and Screen Sharing. Five Macs cost $92 to $299 a month, paid in Monero, Bitcoin, USDT or 4 other coins, with no KYC and delivery within 24 hours.
