Install SSH without an Intel Mac

From AwkwardTV
Jump to: navigation, search

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

  1. 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/
  2. 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.
  3. 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.
  4. 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 (SRC) - extract the sshd file and copy it to OSBoot/usr/sbin
  5. Create the ssh.plist file as shown here http://wiki.awkwardtv.org/wiki/Install_SSH
  6. 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.
  7. Return the drive to the AppleTV and start it up.
  8. 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.

  1. 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
  2. Download Darwin 8.0.1 from http://www.opensource.apple.com/darwinsource/images/darwinx86-801.iso.gz (Firefox users: Right-click/Save-As!)
  3. Extract and burn the .iso file


Now, on a recent machine (Darwin requires a CPU that supports SSE2):

  1. Attach the AppleTV HDD, either with a USB enclosure or an IDE adaptor
  2. Plug in your thumbdrive
  3. Boot from the Darwin CD
  4. 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
  5. 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:

  1. mount -t hfs /dev/diskXs3 /mnt (replace the X with the proper number for the AppleTV drive)
  2. mount -t msdos /dev/diskXs1 /mnt/mnt (replace the X with the proper number for your USB thumbdrive)
  3. 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
  4. cp /mnt/mnt/ssh.plist /mnt/System/Library/LaunchDaemons/ssh.plist (Copy the .plist from your thumbdrive)
  5. 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)
    For Take 2, additional files are needed. See Install_SSH#Notes_for_Take_2
  6. umount /mnt/mnt (Unmount the thumbdrive)
  7. umount /mnt (Unmount the AppleTV drive)
  8. shutdown -h now