If your Mac is your primary computer, you’ll like to have the ability to connect to it remotely from another computer. This gives you access to your files and folders even when you’re away from your machine.

If your second computer happens to be a Windows machine, you can use the SSH protocol to remote connect to your Mac from your Windows computer. This establishes a very secure connection between two of your computers and lets you work on your Mac files from your Windows machine.

Table of Contents
    Access Mac Remotely From Windows

    In order to connect a Windows PC to your Mac via SSH, you need to first configure a few options on your Mac. Then you’ll be all set to connect to your Mac from any Windows computer located anywhere in the world.

    Enable The Remote Login Feature On Mac

    Your Mac has a feature called Remote Login that allows other computers on your network as well as on the Internet to remote connect to your Mac and perform tasks on it. To be able to SSH into your Mac from a Windows PC, you need to first enable this option on your Mac.

    • Click on the Apple logo at the top-left corner of your screen and select System Preferences.
    Systems Preferences under Apple menu selected
    • On the following screen, find the option that says Sharing and click on it. It’ll open the sharing settings menu for your Mac.
    Sharing in the Systems Preferences window
    • The screen that opens has several options letting you share the contents of your Mac. Find the option that says Remote Login in the list and put a tick-mark in its box. This will enable the feature on your Mac.
    Remote Login box checked in Sharing window

    You are now all set to connect to your Mac from your Windows PC over SSH.

    The only thing you now need is the IP address of your Mac. If you’ll be connecting from a Windows machine that is on the same network as your Mac, you’ll need the local IP of your Mac. You then don’t need to enable port forwarding on your router.

    If you’ll be connecting from a Windows machine that’s not on your home network, you’ll need the global IP of your Mac. In this case, you’ll need to follow the port forwarding instructions given below to access your Mac remotely.

    Find The Local IP Of Your Mac

    You’ll find your Mac’s local IP on the Sharing pane you accessed previously. If you’ve closed it already, click on the WiFi icon at the top and select Open Network Preferences.

    IP address in Network settings

    Your IP address should be listed on the following screen.

    Find The Global IP Of Your Mac

    You can do a simple Google search to find your IP address on the global Internet.

    Head over to Google and search for My IP Address.

    My IP Address shown in Google

    Google will let you know your public IP address.

    Set Up Port Forwarding On Your Router

    If you’re going to be remotely connecting to your Mac from a Windows PC far away from your home and not on your local network, you’ll need to forward the port on your router as shown below.

    • Open a new tab in your browser, enter 192.168.1.1 in the address bar, and hit Enter. It’ll open your router’s settings page.
    • When the page opens, log in using the default login which is admin and admin for both the fields and continue.
    Login screen on router
    • Click on Forwarding at the top to open your forwarding settings page.
    Forwarding tab in wireless router
    • Click on Port Forwarding on the following screen. Enter 22 and 22 in both port fields. Then, enter the local IP of your Mac in the LAN IP field, tick-mark Enable, and click on OK at the bottom.
    Port Forwarding screen in wireless router

    All the incoming traffic for your IP on port 22 will now be forwarded to your Mac. The reason you used port 22 is because it’s the port that SSH uses for connections.

    Remote Connect To Mac with SSH Using PuTTY

    PuTTY is a free SSH client available for Windows machines that lets you easily connect to any remote computer over the SSH protocol. This is what you’ll be using to remote connect to your Mac from your Windows computer.

    • Head over to the PuTTY website and download and install the app on your PC.
    • Launch the app when it’s installed. The main interface shows several fields you can enter values.
    • Put your cursor in the Host Name field and type in the IP address of your Mac.
    • Ensure the Port field has 22 in it.
    • Select the SSH option to ensure you’re connecting using the SSH protocol.
    • Finally, click on Open to open a remote connection to your Mac.
    Host Name Screen and Open button highlighted in PuTTy Configuration window
    • It’ll ask you to enter the username for your Mac. Enter your Mac username and press Enter.
    Login as prompt
    • You’ll be asked for your user account password. Enter the Mac user account password and press Enter.
    Password prompt
    • If all goes well, you’ll be connected to your Mac from your Windows PC.
    Successful connection of Mac and PC

    Now that you’re connected, you’ll want to know what things you can do with your SSH connection. Here are some of the basic commands you can run to perform actions on your Mac.

    View Files And Folders List

    To view the files and folders list for your current directory, you can run the following command.

    ls

    ls command in terminal window

    Change The Directory

    To change the current directory in your SSH session, use the following command.

    cd new-directory

    cd command in terminal

    View File Contents

    You can access the contents of a file using an SSH command as follows.

    cat file-name.ext

    Contents of cat Story.txt file

    Create a New Folder

    SSH lets you create new directories as well. To do it, run the following.

    mkdir directory-name

    Mkdir command in terminal

    Create a New File

    You can even create a new file remotely on your Mac from Windows.

    touch file-name.ext

    touch command in terminal window

    Delete a File

    To get rid of a file on your Mac, use the following command on your PC.

    rm file-name.ext

    rm command in terminal

    In addition to these, SSH has several other commands you can use to perform tasks on your Mac from your PC.