Installing and Configuring a FTP Server in Your Apple TV 1st Generation

by Ruben on August 28, 2011

Install FTP server in your Apple TV

Today we will install an FTP server in one of our Apple TV 1. FTP means File Transfer Protocol, and a FTP server is a program sitting in your device, waiting for someone to send him files (or ready to send them). Then, if you have an FTP server in your Apple TV, you can transfer files easily an quickly from your Mac OS (in a Finder window, Go menu and select connect to server, then ftp://locationofappletv) or your Windows machine (just enter ftp://locationofappletv in your Explorer window).

For this tutorial to work, you need to have SSH access to your Apple TV. Of course, this is the first step in any jailbreaking tutorial, so I’ll assume you are past this step. If you are not, you can find more details in our How-To category.

This will only work (in an useful way) in an Apple TV1, since the Apple TV2 lacks a hard drive and FTP needs somewhere to store the files. What else do you need? Well, you need the FTP daemon. A daemon is a special kind of program in UNIX systems that watches what is happening… Oddly enough, the name comes from electromagnetism’s theory father, James Maxwell. Odd happenings.

Where can you get this little program? The easiest source is an Intel Mac. You can copy this file straight if you are in a Mac computer: it is located in /usr/libexec/ftpd You have to copy it to /usr/bin/ftpd You also need to make it executable, do it by logging to your Apple TV and then

sudo -s
chmod +x /usr/bin/ftpd

What happens if you don’t have a Mac installation at hand? Well, I found a trick in AwkwardTV‘s wiki to install the FTP server. You just grab it from the recovery partition in your Apple TV. This is a special part of your Apple TV’s harddrive where Apple puts a copy of the operating system. Then, if everything fails, you can safely start your system from there.

The procedure for getting this is as follows: You ssh into your Apple TV and then issue the following commands:

sudo -s
dd if=/dev/disk0s2 of=$INSTALL_SOURCE/recovery.dmg bs=1m
hdiutil mount $INSTALL_SOURCE/recovery.dmg
hdiutil mount /Volumes/Recovery/OS.dmg
cp -p /Volumes/OSBoot\ 1/$DAEMON /usr/bin/
chown root:wheel /$DAEMON
hdiutil unmount /Volumes/OSBoot\ 1
hdiutil unmount /Volumes/Recovery -force
chown root:wheel /usr/libexec/ftpd

This is just the UNIX way of mounting the recovery disc, copying the file, making the file usable and unmounting the disk. It won’t fire any missiles anywhere.

Things are closer to an end. Now we have the FTP daemon sitting in your Apple TV… But it isn’t active yet. Moreover, we want to be able to connect to it, so we need some user that can talk with him. Enter into your Apple TV via SSH and issue the following:

If you know what you are doing, you can do use some command line text editor. What does this blurb do? It writes a PList file (a property list in Apple’s OSes) telling iOS to run the FTP daemon. To write it, we use the UNIX command cat, which is one of the simplest ways to write a file. Once we have this file, we can load the daemon with:

launchctl load $PLIST_FILE

Now the only thing left to do is create a user to access via FTP We will name this user appletvftp. Run the following via SSH:
cat >> $USERS_FILE <<EOT
appletvftp    allow

Yay! The only thing left to do is to check that you can transfer files to your Apple TV. Follow the steps we said at the beginning about Mac’s Finder or Windows’ Explorer. By the way, if you are in a Linux system, you have several ways to access, probably your file manager has some “connect to server” option quite visible. Try it.

I hope this has helped all those Apple TV 1 users out there! Stay tuned for more tutorials, and don’t forget to subscribe to our brand new newsletter.

Picture courtesy of Omoon at Flickr

  • Colonelclank

    Great tip…. thanks Ruben.

  • entacoed

    This requires sshd to be running to do the install.  So if you already have SSH, why don’t you use the superior SFTP protocol?  Why would you want to install an FTP server, when you already have something better?

  • Matthew Street89

    Is it not possible to stream from a First gen ATV to an Atv 2 once you’ve done this?

  • Pingback: Samplings from August 28th | Sample the Web()

  • Baggies

    SFTP – Avg xfer speed = 2Mb/s
    FTP – Avg xfer speed = 7Mb/s!!!!!

  • entacoed

    Then you’re doing something wrong.  You’ll should achieve superior performance from SFTP due to the compression that comes along with the protocol.  Worst-case, you’ll see about parity.  Also with SFTP, you actually have encryption, rather than letting your credentials hang out in the wind.

    Even your completely anecdotal evidence is bad.  Wow — FTP is 3.5x faster that SFTP!  Oh wait, Baggies’s data points are 2Mb/s and 7Mb/s.  Baggies clearly just switched from token ring to his first 10bT network.  Welcome to the 90s.  Seriously, how are either of those values acceptable?

    Just in case you’re not trolling, go take a look at your network and check all your port speed and duplex settings.  Yes, I’m sure you have everything on autonegotiate, but verify it actually negotiated something sane.  If there aren’t duplex mismatches all throughout your chain, I’ll eat my hat.

  • editor

    Even if you have sftp via sshd, you have to set up the permissions as in the end of the post. Then it is just a matter of wanting secure transfers or not even bothering. You could even use scp if you were so inclined (and scp usually gets better transfer speeds, depending a little on the networking)

  • editor

    If it was possible before, it should be possible after. But it has nothing to do with streaming, so…

  • entacoed

    SFTP and SCP are just different methods of calling SSH; they are effectively providing a set of commands that people are used to.  For people who grew up with FTP, they don’t have to learn a new syntax.

    SFTP and SCP will have the same xfer rates.  Doesn’t depend on “the networking.”

    Anyway, my main point is that SSH is already there and doesn’t require an install, it provides the same or better xfer rate as FTP, and has the side benefit of encrypting the entire conversation, including the authentication.  Just don’t see why you wouldn’t use it.

  • ProjectX

    Hi Ruben
    Have you ever got an AppleTV to boot from OSX 10.5.8 and have working analogue Sound

    Thanks in advance Ray

  • Pookie3

    Hi, new to AppleTV, wondering how do I get Netflix to give me Dolby Digital 5.1 ? I have it connected to my amp via optical cable but it only gives me stereo output 🙁

  • Rebirtha1

    If the optical goes to the TV first, then optical from TV to amp, the result will be stereo output as the TV lacks the decoding ability or whathaveyou.  I’m sure there is a more technical explanation for what I’m describing.

  • Great tip…. thanks Ruben. This is a wonderful.

  • Baggies

    Wow you’re a bit aggressive aren’t you. I’m not trolling. I’ve taken the figures from another site. Not calculated myself.

    Look at section why standard ftp?

    I was the one that contacted this site and asked them to create a more user friendly guide for the above wiki page. 

  • Baggies

    Wow you’re a bit aggressive aren’t you. I’m not trolling. I’ve taken the figures from another site. Not calculated myself.

    Look at section why standard ftp?

    I was the one that contacted this site and asked them to create a more user friendly guide for the above wiki page. 

  • Tjx1444

    This worked great. I can’t figure out which directory to copy programs to. Everything looks encrypted. Anyone?

  • Haavdwee

    Upon entering: cp -p /Volumes/OSBoot 1/$DAEMON /usr/bin/

    I get

    cp: /Volumes/OSBoot 1/usr/libexec/ftpd: No such file or directory

    What could I be doing wrong?

  • Shane

    When I get to the line:  cp -p /Volumes/OSBoot 1/$DAEMON usr/bin/
    I get the response: cp: directory usr/bin does not exist

    I don’t ever work in Terminal.  Trying to do this was scary enough, but I figured if I was careful to do everything step-by-step, it would work.  I’ve triple-checked my command logs and can’t find anything different than what was on here.  Is it obvious where I went wrong?

  • Tjx1444

    Upon entering: cp -p /Volumes/OSBoot 1/$DAEMON /usr/bin/
    I get
    cp: /Volumes/OSBoot 1/usr/libexec/ftpd: No such file or directory
    What could I be doing wrong?

    Same Here!

  • Tj

    Damn, every solution I find in Google points back to this tutorial that does not work. 
    No such file or directory as the previous poster states.

  • Thomas

    same here. “usr/bin does not exist”. what now?

Previous post:

Next post: