How to Remote Connect to Mac from Windows with SSH.
If your Mac is your primary computer, you would like to be able to connect to it remotely from another computer. This gives you access to your files and folders even when you are away from your computer.
If your second computer is running Windows, you can use the SSH protocol to remotely connect to your Mac from a Windows computer. This establishes a very secure connection between your two computers and allows you to work with Mac files from your Windows computer.
To connect your Windows PC to your Mac via SSH, you need to first configure a few settings on your Mac. Then you are ready to connect to your Mac from any Windows PC, anywhere in the world.
Enable Remote Sign-in on Mac
Your Mac has a remote login feature that allows other computers on your network, as well as the Internet, to remotely connect to and perform tasks on your Mac. In order to be able to SSH to your Mac from a Windows PC, you need to first enable this option on your Mac.
- Click the Apple logo in the upper left corner of the screen and select System Preferences.
- On the next screen, find the Share option and click it. This will open the Sharing preferences menu on your Mac.
- On the screen that opens, there are several options to share your Mac’s content. Find the parameter labeled “Remote Login” in the list and tick it. This will activate the feature on your Mac.
You are now all set to connect to your Mac from a Windows PC over SSH.
The only thing you need now is your Mac’s IP address. If you are connecting from a Windows computer that is on the same network as your Mac, you will need the local IP address of your Mac. In this case, you don’t need to enable port forwarding on your router.
–
If you’re connecting from a Windows computer that’s not on your home network, you’ll need your Mac’s global IP address. In this case, you will need to follow the port forwarding instructions below to access your Mac remotely.
Find your Mac’s local IP
You will find your Mac’s local IP address in the sharing pane that you accessed earlier. If you’ve already closed it, click the Wi-Fi icon at the top and select Open Network Settings.
Your IP address should be listed on the next screen.
Find your Mac’s global IP address
You can do a simple Google search to find your IP address on the global Internet.
Go to Google and search for “My IP Address“.
Google will tell you your public IP address.
Set up port forwarding on your router
If you are going to remotely connect to your Mac from a Windows PC away from home and not on your local network, you need to forward the port on your router as shown below.
- Open a new tab in your browser, type 192.168.1.1 in the address bar and press Enter. Your router’s settings page will open.
- When the page opens, log in using the default usernames admin and admin for both fields and proceed.
- Click “Forwarding” at the top to open the forwarding settings page.
- Click Port Forwarding on the next screen. Enter 22 and 22 in both port fields. Then enter the local IP address of your Mac in the LAN IP field, check the Enable box and click OK at the bottom.
All incoming traffic for your IP address on port 22 will now be redirected to your Mac. The reason you used port 22 is because it is the port that SSH uses for connections.
Connect remotely to Mac using SSH using PuTTY
PuTTY is a free SSH client available for Windows computers that allows you to easily connect to any remote computer using the SSH protocol. This is what you will use to remotely connect to a Mac from a Windows computer.
- Go to the PuTTY website, download and install the application on your computer.
- Launch the application when it is installed. The main interface displays several fields where you can enter values.
- Place your cursor in the Host Name field and enter the IP address of your Mac.
- Make sure the Port field is 22 in it.
- Select the SSH option to ensure that you are connecting using SSH.
- Finally, click Open to open a remote connection to your Mac.
- You will be prompted for a username for your Mac. Enter your Mac username and press Enter.
- You will be prompted for your user account password. Enter your Mac user account password and press Enter.
- If all goes well, you will connect to your Mac from a Windows PC.
Now that you are connected, you need to know what you can do with an SSH connection. Here are some of the basic commands you can run to perform actions on your Mac.
View a list of files and folders
To view the list of files and folders for the current directory, you can run the following command.
ls
Change directory
To change the current directory in an SSH session, use the following command.
cd new directory
View file content
You can access the contents of the file using the following SSH command.
cat filename.ext
Create new folder
SSH also allows you to create new directories. To do this, do the following.
mkdir dir-name
Create new file
You can even create a new file on your Mac remotely from Windows.
tap file-name.ext
Delete file
To get rid of the file on your Mac, use the following command on your PC.
rm filename.ext
In addition to this, SSH has a number of other commands that you can use to perform tasks on your Mac from your PC.
–