Skip to content
RentCloudMac

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

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.

Updated , by the RentCloudMac team

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
# 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
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.

Which VNC client should you use from each system?

VNC clients that open macOS Screen Sharing through an SSH tunnel
Your computerClientmacOS sign-in supportedNote
macOSScreen Sharing (built in)Yesopen vnc://localhost:5901
WindowsRealVNC ViewerYesFree viewer
WindowsTigerVNC ViewerUsually needs a VNC passwordOpen source
LinuxRemminaDepends on pluginVNC plugin, localhost:5901
iPadScreens or a VNC app with SSH tunnellingVaries by appCheck 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; dashboard fields are explained in SSH and Screen Sharing help.

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.

Open a Mac desktop of your own

Compile: M4 · 16 GB · 256 GB, Screen Sharing on, paid in crypto with no KYC.

Sources (3)
  1. Turn Screen Sharing on or off on Mac — Apple
  2. ssh(1) manual: -L local forwarding — OpenBSD
  3. RealVNC Viewer download — RealVNC

Read next

from $92 a month

Rent a Mac