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 INSTALL_SOURCE='/tmp' DAEMON='usr/libexec/ftpd' 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:
USERS_FILE='/etc/ftpusers' cat >> $USERS_FILE <<EOT appletvftp allow EOT
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
Comments
Be The First to Comment