Go Back   The macosxhints Forums > OS X Help Requests > Networking



Reply
 
Thread Tools Rate Thread Display Modes
Old 07-27-2006, 12:26 AM   #1
aphinity
Prospect
 
Join Date: Jul 2006
Posts: 2
Hi there,

Maybe this is old news, but I"ve never seen this posted anywhere. Have I actually come up with a new solution?

Something that has bothered much of the mac world for some time, particularly those who have ever attempted to setup an ftp server behind a firewall or a router, is that the built-in ftp service in Mac OS X 10.4 is a stripped down, unconfigurable service with no way to configure things like passive port ranges - or so we thought.

For those who don't know, most ftp servers require a range (a very large range) of ports available for use, selected at random, whenever a connected client requests a file or directory listing outside of the root. The main ports used are ports 20 and 21, but the other randomly selected port is picked frorm anywhere between 1024 and 65535 on the OS X ftp server. Sadly, we cannot predict which one it will pick, meaning if you do not setup your router or firewall to allow access from the client to your ftp server, the transfer will fail. That means you have to open a HECK of a lot of ports to your server.

There IS a better way. You do NOT have to install another ftp service!

The service running in OS X is a variant of tnftpd or something very similar, which is configured with a file called ftpd.conf stored in the hidden /etc folder on your hard drive. There is detailed information on what you can configure the ftp server to do from within this file.

Here's the tricky part. The ftpd.conf file DOES NOT EXIST by default. If you create it, the ftp service will see it, and follow the directions in it, INCLUDING a specific passive ftp port range! Woo! Be sure to restart the service in the control panel/sharing after you modify the file.

Let's say you have your ftp server behind an apple airport extreme base station. Quickly described, here is what you have to do:

1. Enable the root user in /Applications/Utilities/NetInfo Manager and set a password.
2. Open terminal in /Applications/Utilities/ and type:
Quote:
su root

.. then enter your password.
3. type:
Quote:
cd /etc
pico ftpd.conf

4. From within the pico text editor, type:
Quote:
portrange all 49152 49155

5. Press Control-X together, type a Y to say yes to saving, and hit enter to confirm the name of the new file.
6. Go into your System Preferences/Sharing and turn off the ftp sharing, then turn it on again. You're done!

Now that you've done this, you only have to point ports 20, 21, 40152, 40153, 40154 and 40155 to your ftp server from your router, and your ftp server will work perfectly! No more problems connecting!

Enjoy!


-Rob Harrison

PS: I know ftp is insecure. Please don't hijack the thread with comments about that.
aphinity is offline   Reply With Quote
Old 07-27-2006, 08:35 AM   #2
hayne
Moderator
 
Join Date: Jan 2002
Location: Montreal
Posts: 29,279
Quote:
Originally Posted by aphinity
1. Enable the root user in /Applications/Utilities/NetInfo Manager and set a password.

There is absolutely no need to enable the root user. This is definitely not recommended.
Instead, just use 'sudo'. See this Unix FAQ
__________________
hayne.net/macosx.html
hayne is offline   Reply With Quote
Old 08-24-2006, 01:00 PM   #3
rajulkabir
Prospect
 
Join Date: Aug 2006
Posts: 3
Quote:
Originally Posted by hayne
There is absolutely no need to enable the root user. This is definitely not recommended.
Instead, just use 'sudo'. See this Unix FAQ

What possible difference is there? You can do exactly the same smart and dumb things as root or via sudo.
rajulkabir is offline   Reply With Quote
Old 08-25-2006, 11:46 AM   #4
hayne
Moderator
 
Join Date: Jan 2002
Location: Montreal
Posts: 29,279
Quote:
Originally Posted by rajulkabir
What possible difference is there? You can do exactly the same smart and dumb things as root or via sudo.

Well, one big advantage of using 'sudo' is that everything is logged.
And it avoids situations where you forget that you are logged in as root and mess things up.
__________________
hayne.net/macosx.html
hayne is offline   Reply With Quote
Old 07-27-2006, 10:09 AM   #5
voldenuit
Hall of Famer
 
Join Date: Sep 2003
Location: Old Europe
Posts: 4,896
Quote:
Originally Posted by aphinity
PS: I know ftp is insecure. Please don't hijack the thread with comments about that.

Good for for you that you know ftp is insecure.

How exactly would it be "hijacking" the thread by pointing out that it is a Very Bad Idea to do what you suggest security-wise ?

Grace this forum with directions how to run sftp for a change, would you ?
voldenuit is offline   Reply With Quote
Old 08-16-2006, 01:14 AM   #6
aphinity
Prospect
 
Join Date: Jul 2006
Posts: 2
Quote:
Originally Posted by voldenuit
Good for for you that you know ftp is insecure.

How exactly would it be "hijacking" the thread by pointing out that it is a Very Bad Idea to do what you suggest security-wise ?

Grace this forum with directions how to run sftp for a change, would you ?

Because some people don't care about security and just want a simple means to exchange files with people.

Wow.. I come up with an answer that I know others have been looking for, and I get criticism. That's just great.
aphinity is offline   Reply With Quote
Old 08-16-2006, 09:07 AM   #7
Craig R. Arko
Site Admin
 
Join Date: Dec 2001
Location: Minneapolis, MN
Posts: 3,771
Thanks. Around here, many of us do care about the security of our systems and networks, so advising us to ignore that topic is not likely to go unquestioned.
Craig R. Arko is offline   Reply With Quote
Old 08-25-2006, 10:31 AM   #8
aphinity
Prospect
 
Join Date: Jul 2006
Posts: 2
Quote:
Originally Posted by Craig R. Arko
Thanks. Around here, many of us do care about the security of our systems and networks, so advising us to ignore that topic is not likely to go unquestioned.

My whole point was that this is not meant to be a discussion about the security of the ftp protocol. The protocol is widely used, is included with the operating system, and this is a way to allow it to work for people who would like it to who happen to be behind a router.

End of discussion.

If you want security, you shouldn't use FTP. I think that point has been made many times over in other threads.
aphinity is offline   Reply With Quote
Old 07-27-2006, 10:22 AM   #9
Mikey-San
Hall of Famer
 
Join Date: Jan 2002
Location: twitter.com/mikeysan
Posts: 3,481
On top of that, don't enable the root user to do something like this. You don't need it.

Code:
$ cd /etc
$ sudo pico ftpd.conf
__________________
COMPUTER TYPE
SOME SPECIFICATIONS I COPIED FROM THE BOX
STUFF I INSTALLED ALL BY MYSELF
"WITTY QUOTE"
Mikey-San is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:53 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Site design © Mac Publishing LLC; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of Mac Publishing LLC.