Changing Default ftp Port

I am trying to set a custom port number for the FTP service on my Mac Mini.

I do understand the security risks of using ftp.

I am NOT running OS X Server.

I am running OS X 10.9.5.

Ideally, I am trying to change the default ftp Port to 2120.

Not sure if I need to edit the ftp.plist or /etc/services file........

I would be extremely grateful if someone could walk me through this.

Posted on Apr 11, 2017 4:38 AM

Reply
6 replies

Apr 11, 2017 11:11 AM in response to WatfordFCMichael

Most routers will allow you to specify a different Internet side port from the home LAN side port.


For example I have a high numbers port open on the internet (eg 23456) which the router maps to port 22 on my Mac. I can make ssh connections to my Mac from the internet by just using


ssh -p 23456 <routers.IP.Address>

sftp -P 23456 <routers.IP.Address>

scp -P 23456 <routers.IP.Address>


The internet side NEVER seens port 22 being open. It is some very high number that is not in common use, and I'm the one that knows about it. NOTE: 23456 is not the real port number 🙂 )


PortForward.com has documents providing step-by-step guides on how to setup port forwarding for a huge list of routers

<http://portforward.com/>

Apr 11, 2017 6:02 AM in response to WatfordFCMichael

Is this just for A) home home LAN? Or B) for a home Mac with port 2120 port forwarded through your router? Or C) for a corporate network?


If "B", then you should be able to tell your home router to port forward between the Mac's default FTP port number and whatever port number you want visible on the Internet.


If "A" or "C", then maybe you can use "man pfctl" and "man pf.conf" to translate one port to another. Google searching for examples might help: "pf.conf port forwarding example"


pf.conf changes are just speculation on my part, so your mileage may vary.

Apr 11, 2017 6:15 AM in response to BobHarris

Hi Bob

Thank you for your reply.

Currently I am unsure what the default ftp port is on the MacMini - I believe it is 21.

I want to configure this ftp port to 2120 and open that port up on my router [Option B].

Currently I have already opened up port 21 on my router which is pointing at my WDCloud Unit on my network.

Therefore, once I know which file[s] to edit, which I expect will should show the current ftp port, I can make the changes.

Any further help or ideas will be very much appreciated. Thank You.

Apr 12, 2017 8:14 PM in response to WatfordFCMichael

PS. I actually ONLY port forward the ssh port (again high number on the Internet side going to port 22 on the Mac).


If I want to allow other protocols, such as AFP, or VNC/Screen Sharing I setup an ssh tunnel. From the remote Mac, I issue:

ssh -p 23456 -L 22548:localhost:548 -L 22590:localhost:5900 <My.Routers.IP.Addr>

This will establish an ssh connection using the 23456 port forwarded port into my Mac at home.


the -L setups an ssh tunnel.


22548:localhost:548 establishes an AFP (Apple FileSharing Protocol) local port 22548 through an ssh tunnel to the Mac in my home and directs the other side of the tunnel into the standard AFP port 548.


To use this tunnel, on the Mac I'm sitting in front of, I just use a Terminal session command:

open afp://localhost:22548

and this will allow me to mount a volume from the Mac in my home onto the Mac I'm sitting in front of.


=L 22590:localhost:5900 creates an ssh tunnel for VNC/Screen Sharing (5900 is the VNC/Screen Sharing port). To use this tunnel, I use the a Terminal session command:

open vnc://localhost:22590

I can create an ssh tunnel for any TCP based protocol as long as I know the port numbers I need to connect with _AND_ if I can tell the service to use my funky localhost:nnnnn connection address, where nnnnn is the port number I'm using on the local system as the entry to the tunnel.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Changing Default ftp Port

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.