Install SSH without an Intel Mac
Ok so there are lots of guides around which will show you how to get an AppleTV up and running with an Intel Mac, but what if you don't have one?
Installing sshd with a Windows XP box
- For now you will need to open up your AppleTV and remove the hard drive. This process is described here http://de.engadget.com/2007/03/23/how-to-upgrade-the-drive-in-your-apple-tv/
- Now for our next trick we need to mount the drive. Download Macdrive 7 trial version http://www.mediafour.com/support/trials_updates.asp This program is rather fragile, and its drivers don't play nice with Alcohol or Daemon Tools SCSI pass through drivers. If you have either of these installed you will have to remove them temporarily.
- Once the MacDrive software is installed, plug the hard drive into any 2.5" USB adapter/enclosure. Plug in the USB and the MacDrive software should recognize the OSBoot and Media partitions.
- Download the sshd from http://darwinsource.opendarwin.org/Roots/OpenSSH-56.root.tar.gz or http://www.opensource.apple.com/darwinsource/tarballs/other/OpenSSH-56.tar.gz - extract the sshd file and copy it to OSBoot/usr/sbin
- Create the ssh.plist file as shown here http://wiki.awkwardtv.org/wiki/Install_SSH
- You need to set executable permissions on the /usr/sbin/sshd. This can be done in a variety of ways. The easiest, however, is to go install cygwin from: http://www.cygwin.com/ Accept the default installation parameters. Once installed, run it and type "cd /cygdrive/OSBOOTDRIVELETTERHERE/usr/sbin" then type "chmod a+rwx sshd". You can now close cygwin.
- Return the drive to the AppleTV and start it up.
- You should now be able to access the AppleTV through ssh and scp.
Note: An alternative way to add executable privileges on the drive is to mount it from linux (I used CentOS5 under VMware Workstation 6) and change the permissions from there. This needs to be a forceful mount as Linux doesn't support modifying HFS+ by default.
mount -t hfsplus -o force /dev/sdc3 /mnt/appletv chmod 555 /mnt/appletv/usr/sbin/sshd umount /dev/sdc3
If you're uncomfortable with the forceful mount of a journaled file system, remount with MacDrive 7 on your Windows host and it should (I think) take care of any journaling issues. You can then re-mount it on your Linux host and verify that the chmod is still effective.
Installing sshd using a Darwin/X86 CD
Here's another way to install sshd without an Intel Mac handy.
- Copy the ssh.plist text from http://wiki.awkwardtv.org/wiki/Install_SSH into a file and stick it in the root of a USB thumbdrive
- Download Darwin 8.0.1 from http://www.opensource.apple.com/darwinsource/images/darwinx86-801.iso.gz (Firefox users: Right-click/Save-As!)
- Extract and burn the .iso file
Now, on a recent machine (Darwin requires a CPU that supports SSE2):
- Attach the AppleTV HDD, either with a USB enclosure or an IDE adaptor
- Plug in your thumbdrive
- Boot from the Darwin CD
- When prompted to press any key for boot options, press any key, then enter "-s" for your boot option to enter single-user mode
NOTE: I had to add "platform=x86pc" on a T60p Thinkpad
- You can figure out how Darwin has recognized the AppleTV drive and your thumbdrive with "fdisk -d /dev/rdiskX", or just do ls /dev/disk*. The AppleTV drive will show up with diskXs1 through diskXs4, and the thumbdrive will probably have only a diskXs1 entry. The boot CD will also show up, but it'll have a few entries like diskXs1s1, so it's easy to spot.
When the shell comes up, run the following commands:
- mount -t hfs /dev/diskXs3 /mnt (replace the X with the proper number for the AppleTV drive)
- mount -t msdos /dev/diskXs1 /mnt/mnt (replace the X with the proper number for your USB thumbdrive)
- mv mnt/System/Library/LaunchDaemons/ssh.plist mnt/System/Library/LaunchDaemons/ssh.plist.orig (Back up the .plist, just in case)
NOTE: this backup pretty much not needed these days; skip this step
- cp /mnt/mnt/ssh.plist /mnt/System/Library/LaunchDaemons/ssh.plist (Copy the .plist from your thumbdrive)
- cp /usr/sbin/sshd /mnt/usr/sbin/sshd (The one on the Darwin CD works just fine)
VERY useful about now: cp /usr/bin/unzip /mnt/usr/bin/unzip (prepare for life after SSH access)
Optional goodies: cp /usr/bin/diff /mnt/usr/bin/diff
If you know vi: cp /usr/bin/vim /mnt/usr/bin/vim
Similarly, any commands you find useful in Darwin's /usr/bin or /usr/sbin etc. (not everything will work on ATV, though)
- umount /mnt/mnt (Unmount the thumbdrive)
- umount /mnt (Unmount the AppleTV drive)
- shutdown -h now