Establishing an SSH Tunnel to Remotely Access a Mac Using AFP and

Mac Server Remote Access

Server / April 16, 2021

  • Web Development. Developing websites or web apps that typically run off a server; typically Apache/PHP/MySQL
  • Access the server remotely to edit/develop

I belive this is much more than just screen sharing as you don't want to share your screen, just the website you are developing for a client.

You will need the following:

  • Web service listening on the appropriate port
  • Open/forwarded port on your router
  • Dynamic DNS (DDNS) with the ability to update your record

Web service listening on the appropriate port

Typically, when doing Web Dev, this is Apache listening on the correct IP/Port. Assuming that you have just one network adapter, you have to make sure that Apache (or whatever else you are running) is listening so that other computers on your LAN can access it. If you can do this, then you are good to go for the next step

Open and/or forward the port on your router

So, you can get to your service from inside your network, but now it's time to get to it from the outside.

  1. Determine your local IP. Using terminal, issue the command ifconfig en0 grep inet. The line should start off with inet xxx.xxx.xxx.xxx. That's your local IP address
  2. Forward HTTP traffic to that port. There are many routers on the market and each have different user interfaces, but they are all technically doing the same thing: taking traffic bound to your IP and port and forwarding it to an address you specify. You will have to check your user manual for the specifics on how to do this.

    But, basically, you are going to forward port 80 traffic (HTTP) to the IP address you found in step 1.

    Next, you are going to want to test this out. Use a service like IP Chicken or WhatIsMyIP to find your public IP. You can even type the search directly into Bing and have it return your IP address.

    Once you have that, you need to browse to it. A smartphone NOT connected to your WiFi makes a good choice. Point the browser of the smartphone to the public IP address you just obtained. If you can see your page/application, your router is working. If not, you need to go back and make sure your port forwarding is set up correctly.

Setup DDNS

This is the final step. Dynamic DNS allows you to use a domain name to access your IP even though it changes. Many newer routers support DDNS in their firmware - you will need to check with your specific manufacturer and or model.

Even if your router dosen't support DDNS, you are still in luck. All you need is a DDNS client to update your record and it can run on any computer on your network. For example, on FreeDNS's website, they provide a number of different clients you can on virtually every platform from Windows, to Linux and even iOS.

Source: apple.stackexchange.com