Start an FTP or SFTP Server in Mac OS X Lion

Sep 29, 2011 - 10 Comments

FTP Server missing in OS X Lion, but you can enable it anyway

If you’ve visited the Sharing Preference panel since upgrading to Mac OS X 10.7 you may have noticed there is no longer the option to enable an FTP server to share files and folders. It’s unclear why Apple pulled the easy frontend to FTP sharing, but if you still want to run a local FTP server (or SFTP) in Mac OS X you can with the help of the command line.

Start the FTP Server in OS X 10.7

  • Launch the Terminal (/Applications/Utilities) and enter the following command to start the FTP server:
  • sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist

  • Confirm the FTP server works by typing:
  • ftp localhost

If you see the familiar FTP login:

$ ftp localhost
Trying ::1…
Connected to localhost.
220 ::1 FTP server (tnftpd 20100324+GSSAPI) ready.
Name (localhost:Paul):

You know the server is running. If you don’t see that, then the server either hasn’t finished starting yet or you didn’t enter the command properly. You can then FTP from other Macs via the same ftp command, or by using the “Connect to Server” option in the Finder.

Enabling the SFTP Server in OS X 10.7

As you probably know, FTP is unencrypted and as a result as fallen out of favor for security reasons. Enabling SFTP is actually easier than FTP:

  • Launch System Preferences and go to “Sharing”
  • Click on the checkbox next to “Remote Login” to enable SSH (and SFTP)

Update: Our much more detailed guide on Remote Login and SSH Server’s is here.

Enable SFTP Server in Mac OS X Lion

You can verify that SFTP is working by typing this at the command line:
sftp localhost

Note: The FTP and SFTP servers are different and enabling one does not enable the other. SFTP is recommended because of the encryption.

Disable FTP Server in OS X Lion

Here’s how to disable the server:
sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist

As the command suggests, this unloads the ftp daemon and shuts down the server. Obviously you can only shut down and disable the FTP server if it was enabled to begin with.

This is an elaboration on a tip from Land of Danielvia TUAW, who goes on to explain how to get ftpd to launch automatically on reboot, so if you’re interested in that, don’t miss their post.

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS X, Tips & Tricks

10 Comments

» Comments RSS Feed

  1. Douglas says:

    The reason this was removed is that Apple is slowly simplifying OS X so that when it merges with iOS there will be no options to run servers or share files, any sharing will be done through iCloud and within apps.

    • Daniel Smith says:

      Are you retarded?

      Apple will never merge them, it will loose its web developers, program developers and more if it did.

      As a web developer, you seriously don’t know how useful the precompiled Apache is

    • Daniel Smith says:

      On another note, them Sharing things have nothing todo what iCloud does, how would SSH or CUPS be emulated in iCloud?

  2. iamse7en says:

    What if you restart the computer? Does the terminal command need to be entered again?

  3. lzdexic says:

    If you only need / want sftp there is no reason to run the command to enable standard ftp, simply enabling remote login (ssh) will also enable sftp.

  4. Ynot says:

    If I did this, is it secure enough for me to give the address to a client that needs to download a large file from me?

    What address would I give a client?

    Thx

  5. [...] inclusion of SFTP through Remote Login also explains why Apple ditched the FTP server in Lion, they opted for the infinitely more secure SFTP option and bundled it within Sharing’s [...]

  6. Richard says:

    Forgive my ignorance but I have an iMac that, after installing Lion and restarting, I cannot log in to. I can still boot into single user mode. Safe mode does not work. I tried creating a new account via the deletion of the startup file and went through all of that and it still does not work. I can access the files on the iMac from my MBP because FileSharing is enabled. Unfortunately I did not enable Remote Login on the iMac before I had the problem. Since I can boot into the root account via SUM, I assume that I could turn on Remote Login if I knew what to do. I have tried /sbin/service ssh start while in SUM but when I restarted I have been unable to ssh into the system which tells me that login is refused or words something like that. Any ideas? Thanks.

  7. [...] going to need to use FTP at some point, so I kept looking and found an article on OSXDaily about enabling FTP with a command line string.  However, buried in the article is a gem that took me by surprise.  By enabling remote login in [...]

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Shared on Facebook

Shop at Amazon

Ad

OSXDaily on Facebook