Gate the network path with an identity provider that already enforces MFA, then let macOS Remote Login handle only the authenticated final hop. A provider-supported MFA flow then decides who can reach TCP/22 on the Mac, and you do not weaken the operating system by editing /etc/pam.d/sshd. This is network-access MFA, not macOS local-password MFA. Every Figment plan includes SSH and administrator access to your own Mac or VM, so you can set up the pattern below yourself. Figment has not published two-factor options for its own account login or connection, so ask support what applies to your account and do not assume one.
Why is network-level MFA better than editing macOS PAM?
Guides that paste a Linux PAM recipe onto macOS suggest adding pam_google_authenticator.so to /etc/pam.d/sshd with nullok enabled during rollout. That has three problems on a rented Mac.
nullokmeans any account without an enrolled TOTP file bypasses the second factor, which is not MFA.- The library path varies by Homebrew prefix and macOS version, and one wrong path in an
auth requiredline can lock every user out of SSH at once. Recovery then depends on a console path you may not have. - Apple's Remote Login documentation describes the standard password or key prompt and does not document a supported second-factor hook, so a PAM edit is an unsupported local change that you keep maintaining across macOS updates.
Pushing MFA up the stack fixes all three. A tailnet or Zero Trust tunnel refuses to forward traffic to port 22 until the user has completed MFA at your identity provider, the Mac's sshd stays stock, and recovery is "remove the device from the tailnet or the Access application" rather than "comment out a line in a PAM file you cannot reach." The admin who owns the Mac must also close any direct public path to port 22 at the host firewall and test, from a device outside the tunnel, that the block is in effect.
How do I use Tailscale or Cloudflare Access for MFA?
Both are third-party services that you set up with your own account. Figment does not bundle them, and you configure MFA at your identity provider.
Tailscale delegates authentication to the identity provider you already use. Its enable two-factor and multifactor authentication guide states that "Tailscale relies on your existing identity provider to authenticate users" and "any authentication settings from your identity provider are automatically used by Tailscale, including MFA." The workflow is:
- Enable MFA in Google Workspace, Microsoft Entra ID, Okta, OneLogin, or your SAML/OIDC provider.
- Install the Tailscale client on the rented Mac and on each operator's laptop.
- Set an ACL that allows SSH only from a tagged operators group to a tagged Mac host.
Cloudflare Access does the same job for teams already on Cloudflare One. Its MFA requirements policy documentation describes both identity-provider-based MFA and independent MFA, and notes that "if the user fails to present the required MFA method, Cloudflare Access rejects the user, even if they successfully log in to the identity provider with an alternative method." For an SSH target you create a self-hosted Access application in front of the Mac, require an authentication method such as a FIDO2 or PIV key, and connect through cloudflared access ssh on the client.
Pick one. Running both adds moving parts without improving authentication.
How do I set up Remote Login behind the gate?
Keep the macOS side stock. Apple documents Remote Login at support.apple.com/guide/mac-help/mchlp1066: open System Settings, General, Sharing, turn on Remote Login, and restrict it to the user accounts your team will use. Add SSH public-key authentication for each account so the password path is not the one in daily use, and keep one account per operator rather than a shared login.
Once Tailscale or Cloudflare Access is in place and you have confirmed the public path to port 22 is closed, a VNC or Screen Sharing session uses an SSH tunnel through the same authenticated hop, so RFB is never exposed to the internet:
# After your MFA gate has authorised you, forward local 5901 to the Mac's
# Screen Sharing port over the already-authenticated SSH connection.
ssh -L 5901:localhost:5900 -N user@mac-inside-tunnel
# Point your VNC client at 127.0.0.1:5901
This needs no change to /etc/pam.d/sshd, no nullok, and no local PAM path to maintain. If you later need a second factor at the Mac itself, use a vendor-supported mechanism (for example a Jamf-managed policy) rather than a hand-edited PAM stack. Credentials on Figment are per tenant, so they stay inside your own account.
What should I check before I rely on it?
Keep this checklist in the repository next to the tunnel config.
- Where is MFA enforced? At the identity provider in front of the tunnel, not on the Mac's local login.
- What is the session expiry? Set it at the identity provider and at the tunnel ACL, and the shorter one wins.
- How do you revoke a leaver? Remove them from the identity-provider group and from the tailnet or Access application, and test the removal the same day.
- What is the recovery path if the gate misbehaves? Use an owner-controlled path into the Mac that does not depend on the broken tunnel, such as the connection details shown in your Figment account.
- Is there another way into the Mac, and have you tested from outside the tunnel that it is closed?
- Are there per-user accounts on the Mac or one shared login? Use per-user accounts, with individual SSH keys and individual identity-provider logins.
- Who owns admin on the Mac? On Figment that is you, for your own Mac or VM.
Does the MFA method change which plan you need?
The plan depends on the work, not on the MFA method, because every plan includes SSH. The Apple Silicon Mac VM ($39 a month) and the Dedicated M4 Pro 48 GB ($349 a month) suit current Xcode and Apple silicon work, and the Intel Mac VM ($25 a month) suits Xcode 26.3 or earlier.
Related guides: