Mount a Remote Drive via AFP
You must be logged into the Apple TV via SSH and have AppleTV software version 1.0 After the ATV 1.1 upgrade mount_afp is no longer working. (But it can be re-enabled - see Mount a Remote Drive via AFP under 1.1)
1. Enable Personal File Sharing on the network machine you wish to access.
2. From the ssh prompt on the Apple TV, create a folder to mount the share, such as: mkdir /Users/frontrow/afp
3. Mount the share while still at the Apple TV ssh prompt. Here's the command I used:
mount_afp -i afp://joey-imac/Macintosh\ HD /Users/frontrow/afp
"joey-imac" is the name of the machine on my network
"Macintosh HD" is the drive I want to mount (notice you need the \ to escape sequence the space
"/Users/frontrow/afp" is the mountpoint on the Apple TV
You will get a strange errors such as the following:
mount_afp: the mount flags are 0000 the altflags are 0020 /mach: No such file or directory Can't open /mach for reading - No such file or directory kextload: can't map module files kextload: can't check load addresses of modules kextload: a link/load errtouch or occured for kernel extension /System/Library/Filesystems/AppleShare/asp_tcp.kext /mach: No such file or directory Can't open /mach for reading - No such file or directory kextload: can't map module files kextload: can't check load addresses of modules kextload: a link/load error occured for kernel extension /System/Library/Filesystems/AppleShare/afpfs.kext
However, you can change to the directory of the mountpoint (e.g. /Users/frontrow/afp) and access files on the remote machine!
If you boot up with / mounted RW automatically (as in Mount ReadWrite) it will generate the /mach.sym file, which will fix the kext loading issues. If you then make it boot RO by default, it will not delete the /mach.sym file.
You can also mount drives by putting your ID and password into the command:
mount_afp afp://myusername:email@example.com/nixon ~frontrow/Movies/nixon
mount_afp afp://myusername:firstname.lastname@example.org/Silver ~frontrow/Movies/silver
Will mount my main and external drives under the Movies folder where ATVFIles will find it.
Obviously enter your own ID and password on your machine which has all the files. Nixon is the name of my computer's main hard disk, and silver the external. For some unknown reason the AppleTV seems to have problems with mountpoints with capital letters in them, so make sure you give your mount point a lower case name (i.e. silver not SIlver)
You might want to try adding this to your rc.local file to make it happen every time you reboot. So:
sudo echo "mount_afp afp://barry:email@example.com/nixon ~frontrow/Movies/nixon">>/etc/rc.local
that adds the first line to the end of the rc.local file which is run everytime the system boots.
For some reason this doesn't always work and in some cases the rc.local file doesn't exist. A way around it is to use su. su is a rather dangerous command as it effectively allows you to log in as root so use it wisely!
Copy /usr/bin/su from your local OS X installation to the same location on the AppleTV.
Then issue these commands
sudo su - touch /etc/rc.local echo "mount_afp afp://barry:firstname.lastname@example.org/nixon ~frontrow/Movies/nixon">>/etc/rc.local
This will log you on as root, create the file (only if it doesn't exist), add the changes to it. You can then check the changes have been made by typing:
and checking the last line in the file.
Once you're happy, issue this simple command to exit the root shell: