2 thoughts on “Screen Sharing in OS X to Connect to a Different Account on the Local Machine

  1. bowmasters

    Another solution that doesn’t require changing your default vnc port or restarting to disable SIP and modifying multiple files is to use port forwarding. This can be done either with pfctl (packet filter) or by setting up a local ssh tunnel and forwarding the ports.

    Method 1 – pfctl:

    echo ”
    rdr pass inet proto tcp from any to any port 5901 -> 127.0.0.1 port 5900
    ” | sudo pfctl -ef –

    I’m not sure if this will persist across reboots. If not, you may need to modify some config files, which may or may not requires disabling SIP. Alternately, you can create a LaunchAgent that runs the script at startup.

    Method 2 – ssh (make sure “Remote Login” is enabled in sharing preferences first):

    ssh -fN localhost -L 127.0.0.1:5901:localhost:5900

    This will persist until you logout or restart, or if you manually kill the process. Like the pfctl method, this can be made easier by creating a LaunchAgent so it runs at boot. Or you can download the application “SSH Tunnel Manager” which is a gui tool for creating ssh tunnels. You can set it to auto connect the tunnel when it starts and set it to open at login.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.