Enable SSH & AFP on your Apple TV

by editor @ AppleTVHacks.net on March 24, 2007


Credit for the original information used in making this how-to goes to TylerL82 over at the SomethingAwful.com forums. Written up here by Jonathan Bare.

So while you have your Apple TV open and you’re installing a new hard drive or just following along with the people over at SomethingAwful.com forums to get Xvid working, you might as well un-break SSH so you can access the Apple TV remotely.

Opening the Apple TV and connecting the hard drive to your Intel Mac are covered in the hard drive upgrade and elsewhere, so we’ll skip those steps and jump right to the point where you have the OSBoot and Media volumes mounted on your Mac.

This process assumes using an Intel Mac because the sshd binary may or may not be the same in the PowerPC version of Mac OS X; we haven’t checked. If someone would like to try using the PowerPC binary and let us know if it works, that would be great!

There are 2 ways to go about this; using the finder, or via the terminal. The finder method is probably best if you aren’t sure what is going on, whereas the Terminal method is quicker if you are confident.

Step 1 – Using the Finder

Once you have OSBoot mounted in the Finder, double click on its icon. You’ll see something like this:

ssh howto 1 Enable SSH & AFP on your Apple TV

From the Finder’s Go menu, select Go To Folder, or press Command-Shift-G. Type in /Volumes/OSBoot/usr/sbin/ and click Go.

ssh howto 2 Enable SSH & AFP on your Apple TV

Open a new Finder window and do the same thing to go to a folder, this time, however, select /usr/sbin/. This is the same folder located on your Mac’s hard drive.

ssh howto 3 Enable SSH & AFP on your Apple TV

From the Mac’s sbin folder, drag the file “sshd” to the Apple TV’s sbin folder. Your cursor will change in to the green plus sign to indicate that you are making a copy of the file.

Note: If you have accidentally ended up in /usr/bin instead of /usr/sbin and you accidentally copy the “ssh” file instead of “sshd”, you’ve made a big mistake and ssh will not work on your Apple TV. Be sure you are working to and from the respective /usr/sbin directories.

ssh howto 4 Enable SSH & AFP on your Apple TV

You now have sshd installed on your OSBoot volume. Now we need sshd to start when the Apple TV boots up.

In the OSBoot window, choose Go To Folder again and this time, enter /Volumes/OSBoot/System/Library/LaunchDaemons/.

ssh howto 5 Enable SSH & AFP on your Apple TV

If you open the Apple TV’s ssh.plist file from the LaunchDaemons directory, you’ll see why we need to replace it. Apple left a dummy plist file to throw us off the trail.

ssh howto 6 Enable SSH & AFP on your Apple TV

You could copy the ssh.plist file from the same location in your Mac’s /System/Library/LaunchDaemons/, but for simplicity, we’ve included the contents of the plist here (if you do copy from your Mac, ensure SSH is enabled in System Preferences -> Sharing, or it won’t work – thanks to Adam Gill). Using TextEdit, BBEdit, or your favorite text editor, copy and paste this text, replacing the original ssh.plist contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.openssh.sshd</string>
        <key>Program</key>
        <string>/usr/libexec/sshd-keygen-wrapper</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/sbin/sshd</string>
                <string>-i</string>
        </array>
        <key>SessionCreate</key>
        <true/>
        <key>Sockets</key>
        <dict>
                <key>Listeners</key>
                <dict>
                        <key>Bonjour</key>
                        <array>
                                <string>ssh</string>
                                <string>sftp-ssh</string>
                        </array>
                        <key>SockServiceName</key>
                        <string>ssh</string>
                </dict>
        </dict>
        <key>StandardErrorPath</key>
        <string>/dev/null</string>
        <key>inetdCompatibility</key>
        <dict>
                <key>Wait</key>
                <false/>
        </dict>
</dict>
</plist>

Close the file and save it. In a nut shell, the ssh daemon is activated by launchd whenever an incoming connection on port 22 is detected.

Step 1 – Using the Terminal

Firstly, copy the sshd binary from your Mac to the AppleTV drive:


cp /usr/sbin/sshd /Volumes/OSBoot/usr/sbin/.

Next, copy the ssh.plist file over, so launchd knows to start sshd on boot:


cp /System/Library/LaunchDaemons/ssh.plist /Volumes/OSBoot/System/Library/LaunchDaemons/ssh.plist

Alternatively, you could use the contents of the file from above to create an ssh.plist file.

Step 2

Unmount the OSBoot and Media volumes, reassemble your Apple TV, and power it on. You need to get the IP address of the Apple TV from the Settings menu, once you know that, open a Terminal window from your Mac (or any OS that has ssh installed) and type:

ssh frontrow@your.apple.tv.ip.address

Press return. Type “yes” when it asks if you want to permanently store the key. Then enter “frontrow” as the password.

You’re in.

Now what?

SSH opens up a lot of doors to accessing the Apple TV. For example, you can now type sudo /usr/sbin/AppleFileServer and cause the built-in Apple File Protocol (AFP) server to start. Then you can connect to the Apple TV from your Mac by using the Connect to Server command in the Finder. AFP, SCP or SFTP can now be used to copy files to the Apple TV!!

You can type ps auxww to see a list of running processes on your Apple TV. (Hey, what is /usr/bin/ripstop and why is it running under the frontrow user?)

One thing we’ve already learned from SSH is that the root filesystem on the Apple TV (aka OSBoot) is apparently mounted as a read-only filesystem. That means it’s not initially possible to copy any files to the root mount point (/etc, /usr, /var, for example) while it is running. TylerL82 has commented to point out you can remedy this with the sudo mount -uw / command.

It’s also important to note that any changes you make to the OSBoot volume will be wiped out by a Factory Restore of the Apple TV. It appears that a disk image of the stock Apple TV operating system exists on the unlabeled partition on the drive and is used to restore the OSBoot volume when Factory Restore is selected.

  • J

    I wonder how long it’s going to be before the hackers have something resembling full-fledged OSX running on this thing :)

  • dice

    I’d love to know how to do this with a windows XP pc/laptop… As I don’t have access to a mac powerbook (I do intend on buying one some day, now probably sooner than later), is this at all possible to do with a windows PC?

  • Tom @ AppleTVHacks.net

    dice-

    There is a program, Macdrive, which will allow you to mount the Apple TV harddrive.

    You would then need to obtain a copy of sshd from an Intel Mac owning friend; and create the plist file from the details given. Copy them to the correct locations and you should be all done!

    You could then use Putty for SSH access, and WinSCP for SFTP/SCP file transfers.

  • TylerL82

    sudo mount -uw /

    …will mount the AppleTV’s OSBoot partition read/write when run via ssh.

  • http://www.soward.net Soward

    if you touch an empty file in the root directory (/Volumes/OSBoot when connected to your laptop, or / from ssh after a mount -uw /) call .readwrite then whenever your AppleTV boots it will be mounted rw.

    You can also copy over su to get to a real ‘root’ userid, or just cp /bin/sh /bin/shroot and chmod 4755 it.

    you can also enable root by moving over the passwd command and setting the password. Of course beware of all the security implications.

  • Jonathan

    Well duh. Thanks Tyler. :)

    From there, you can scp the directory /usr/libexec/httpd/ from your Mac to the Apple TV. Then run:

    sudo /usr/sbin/apachectl start

    http://your.apple.tv.ip
    or
    http://yourappletvname.local

    Pow. Apache is running. The default httpd.conf file uses the /Library/WebServer/Documents/ directory for its DocumentRoot and also enables the user-level Sites folder, so this also works:

    http://your.apple.tv.ip/~frontrow
    or
    http://yourappletvname.local/~frontrow

  • Scott

    Thanks for this. I had done this previously without success and then tried again with your instructions. I’m always getting

    ssh frontrow@10.0.1.200
    Connection closed by 10.0.1.200

    Not sure what to do next.

  • http://www.soward.net Soward

    Oh, and I’m sure others have tried it, but plugging in a USB keyboard and then holding down Apple-V shows you the normal verbose boot, and Apple-S does boot to a single-user root prompt (or it did for me on my already modified atv), but then there’s no HID driver loaded so you can’t type anything….

  • Jonathan

    Scott:

    Try ssh with the -v switch to get the verbose connection. That could tell you what’s going wrong.

    ssh -v frontrow@10.0.1.200

  • http://www.forcedperfect.net/ Peter

    I’m interested in what a port scan of an Apple TV results in. Although I hear the firewall is enabled by default on them.

    I’ve heard they ship with Apple Remote Desktop client installed. I hate to state the obvious, but has anyone tried copying over their Mac’s ARD client preferences over/manually starting the client?

  • Scott

    Thanks,

    It seems that kerberos is active and the realm can’t be found. Trying to figure this out.

    DSBuch: [whsbti] scott $ ssh -v frontrow@10.0.1.200
    OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /Users/scott/.ssh/config
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 10.0.1.200 [10.0.1.200] port 22.
    debug1: Connection established.
    debug1: identity file /Users/scott/.ssh/identity type 1
    debug1: identity file /Users/scott/.ssh/id_rsa type 1
    debug1: identity file /Users/scott/.ssh/id_dsa type -1
    debug1: Remote protocol version 1.99, remote software version OpenSSH_4.5
    debug1: match: OpenSSH_4.5 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_4.5
    debug1: An invalid name was supplied
    Cannot determine realm for numeric host address

    debug1: An invalid name was supplied
    Cannot determine realm for numeric host address

    debug1: SSH2_MSG_KEXINIT sent
    Connection closed by 10.0.1.200

  • Peter da Silva

    Why on earth would you even imagine the Power PC binary would work?

    # file /usr/sbin/sshd
    /usr/sbin/sshd: Mach-O executable ppc

  • Scott

    Not sure what you’re referring to?? I copied over Universal version from my Macbook Pro.

    DSBuch: [whsbti] scott $ file /usr/sbin/sshd
    /usr/sbin/sshd: Mach-O universal binary with 2 architectures
    /usr/sbin/sshd (for architecture i386): Mach-O executable i386
    /usr/sbin/sshd (for architecture ppc): Mach-O executable ppc

  • Pingback: Apache running on Apple TV | Apple TV Hacks()

  • Scott

    Just to complete my story. I randomly tried ssh switches (last resort you know) and found I can get is with the ssh 1 protocol ??????? so

    ssh -1 frontrow@appletv works

    Anyone who can think what it would be appreciated

  • http://dockingbay94.net Paul Rodriguez

    I get:

    [Spike:~] mrfett% ssh -1v frontrow@appletv.local
    OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to appletv.local [192.168.1.159] port 22.
    debug1: Connection established.
    debug1: identity file /Users/mrfett/.ssh/identity type -1
    ssh_exchange_identification: Connection closed by remote host

    if anyone could help me, it’d be appreciated.

  • http://dockingbay94.net Paul Rodriguez

    same thing with the ip address put in explicitly, btw.

  • http://www.zinkwazi.com greg

    here are the results of a portscan using nmap after installing ssh as outlined above:

    PORT STATE SERVICE
    22/tcp open ssh
    3689/tcp open rendezvous

    Nmap finished: 1 IP address (1 host up) scanned in 577.723 seconds

  • http://www.zinkwazi.com greg

    for those of you getting the “Connection closed by remote host” error after installing ssh as outlined above, all you need to do is specify ssh version 1.
    like this:
    ssh -1 frontrow@192.168.1.152

    and BAM! you’re in :)

  • Dak

    Can someone please upload the Universal Binary version of sshd? I am a PowerPC user myself, so I havent got anywhere to get it from.

  • http://www.zinkwazi.com greg

    you can get root access by simply using su after logging in via ssh:

    -bash-2.05b$ sudo su root
    su-2.05b#

  • http://dockingbay94.net Paul Rodriguez

    After three days I figured out my problem. Kudos to this post for helping me, as I only thought of the solution after using the Finder to look at the files (I had been using the terminal previous to that). I noticed that my sshd file wasn’t being classified as a UNIX shell script, but was being called a “Document”. On a whim, I used “chmod +x sshd” to strip the owner, and voila! it worked. I’m extremely happy. I don’t know why I seem to be the only person who experienced this problem, but whatever. Hope this helps someone.

  • Jonathan

    I’ve seen the -1 switch used to degrade the SSH protocol to SSHv1, but standard ssh username@ip and ssh -2 username@ip has worked fine for me. I’m clueless as to why you’d have a problem with SSHv2.

    On a local network, you’re probably fine with just v1.

  • Jonathan

    I’d like to play around more with the /etc/rc script and the toss in the /etc/hostconfig file. Oh, where to find the time?

    I briefly had ARD/VNC working, but it seems to crash after a few seconds each time I activate it with kickstart and connect.

  • http://www.soward.net soward

    I managed to get ARD working by using the usual command-line enable sequence:

    ./kickstart -activate -configure -access -on -restart -agent -privs -all

    (from /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/Resources )

    you may need to enable apple remote events using systemsetup as well.

    it’s a ARD 2.2.1 client, so it may not work with ARD 3. Also some functions don’t work because the sysinfocachegen command gets a bus error.

    however it doesn’t seem to useful, as it doesn’t respond to any keyboard/mouse input — probably because there’s no input drivers…

  • http://dockingbay94.net Paul Rodriguez

    someone on the awkward irc channel helped me get it working. we put the info on the wiki.

    http://wiki.awkwardtv.org/wiki/index.php?title=Enable_Remote_Desktop_%28VNC%29

  • Pingback: Digividual :: Apple TV has grown on me()

  • Pingback: Enable Remote Desktop on the Apple TV | Apple TV Hacks()

  • iw

    I followed the following instructions for xvid support:
    1. Open it up (4 screws on the bottom, small Torx bit)
    2. Put the 2.5″ drive into a USB enclosure or whatever you want
    3. Mount the HFS filesystem
    4. Install Perian in /Library/Quicktime (as you normally would)
    5. Install Dropbear (or enable SSH if you know how… we gave up and used Dropbear)
    6. Add a startup script to disable the firewall or open up the ports you need for SSH
    7. Put the drive back in and boot it, ssh login as frontrow, password frontrow (or add an ssh key for yourself)
    8. Use a reference movie (use QT Pro to save a reference movie) to bootstrap your xvid file

    Thanks to this page i got up to step 4. So from here does anyone know how to do step “Add a startup script to disable the firewall or open up the ports you need for SSH.”

    Oh and has anyone actually got this xvid thing working?

  • http://www.rghosting.com Dakaix

    Below is a link to the Intel compiled sshd binary, suitible for use on the AppleTV.

    http://www.rghosting.com/AppleTV/

    If anyone wants any other files hosting on our mirror, please use the contact us link on that page.

  • Pingback: padawan.info()

  • Roger

    I’m interested in finding out whether someone with a PPC Mac has attempted this (using the Intel binary of ssh, of course). Is there a risk of the PPC Mac damaging the GUID partition?

  • Jonathan

    I’ve been looking at the configuration and preference files that make up the Internet Sharing abilities of a standard Mac OS X system.

    It appears that…

    /etc/com.apple.named.conf.proxy
    /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
    /Library/Preferences/SystemConfiguration/com.apple.nat.plist
    /Library/Preferences/SystemConfiguration/preferences.plist

    /usr/libexec/InternetSharing
    /usr/sbin/named
    /usr/sbin/natd

    …are at least required and some modification of the conf and plist files will be necessary. The binaries in /usr already appear to be included in the Apple TV, but no way yet of knowing if they actually work.

    Enabling this would allow the Apple TV to be used as a very simple software base station (access point) or a bridge from Airport to Ethernet.

    More to come…

  • Lewiss

    Can someone please tell me how to get read and write privileges? I see you saying mount -uw but I have no idea what that means… The more simple, the better. Thanks

  • Pingback: Top 5 Hacks del AppleTV » Appleblog.es()

  • cklapka

    I get connection refused when I set this up, thoughts?

    cklapkas-MBP:~ cklapka$ ssh -v frontrow@10.0.1.xxx
    OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 10.0.1.xxx [10.0.1.xxx] port 22.
    debug1: connect to address 10.0.1.xxx port 22: Connection refused

    I followed all the instructions while replacing/upgrading my harddrive, I assume I would get another error in the was not service was not running, correct?

    Any help would be great.

    Thanks in advance
    cklapka

  • Pingback: Xyberneticos » Apple TV Hacks - Blog especializado en hackear el Apple TV()

  • Pingback: myMacBUZZ » Apple TV hacks Quicklinks Links()

  • Adam

    Just wondering, has anyone done a uname -a on one of these things? I’d just be interested in which rev. of darwin they’re running

  • Adam

    nevermind, it’s part way down this page, 8.8.2

    http://www.appletvhacks.net/2007/03/23/apple-tv-harddrive-upgrade-process/

  • http://www.macstorm.com Geoffrey Stormzand

    If you use the Terminal commands to copy your current ssh plist file form /System/Library/LaunchDaemons/ssh.plist, you have to have your current ssh settings in your sharing preferrences turned on. Otherwise the first line in the plist file is:

    Disabled

    Label
    com.openssh.sshd
    Program

    this will Keep ssh disabled.

    if it is on, you’ll get:

    Label
    com.openssh.sshd
    Program
    Which turns on ssh.

    Or you could edit the plist file to remove the Disabled True key.

  • Pingback: Install Asterisk on Apple TV | Apple TV Hacks()

  • Pingback: VoIP & Gadgets Blog()

  • Pingback: How to Install Asterisk on Apple TV | Asterisk Topics - Asterisk News, Views, Blog & Discussion.()

  • k

    after I typed ssh -1 frontrow@10.0.1.xxx , Ican see

    Password:
    Response:

    and then I can’t type anything at all.. what shold I need to do?

  • k

    if I just press return key… I can see this below

    Connection closed by 10.0.1.xxx

  • k

    nevermind… everything is working fine now

  • Pingback: Apple TV at Celso Martinho()

  • Pingback: Apple TV at Scattered()

  • http://Yeltrik.net Steve

    Here is a great page for AFP:
    http://docs.info.apple.com/article.html?artnum=108030

    Apple Remote Desktop 2 or later include the “kickstart” command line utility. It allows you to install, uninstall, activate, configure, and restart components of Apple Remote Desktop without restarting the computer. You can configure all the features found in Apple Remote Desktop preferences.

    The kickstart utility is located here:

    /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart

    You need an administrator account to use the kickstart utility. To begin using the kickstart utility, use the sudo command, such as:

    $ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent

    Note: All commands presented in this document should be typed as one line of text. It’s OK if the text wraps as you enter it, just be sure not to enter hard carriage returns.

    Following are some examples of other things you could do.

    1. Activate Remote Desktop Sharing, enable access privileges for all users, restart ARD Agent:

    $ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all

    2. Activate Remote Desktop Sharing, enable access privileges for the users “admin”, grant full privileges for the users “admin”, restart ARD Agent and Menu extra:

    $ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users admin -privs -all -restart -agent -menu

    Note: The -users flag should refererence the shortname of a user of the system.

    3. Activate Remote Desktop Sharing, disable access privileges for all users:

    $ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -off

    4. If you just want to stop the ARD Agent process:

    # sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -agent -stop

    5. If you want to deactivate it:

    # sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off

    Tip: For more information about using the kickstart command, add the -help flag. For example:

    # sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -help

  • Patchsmyle

    An addendum to make connecting to the SSH connection one step easier. AppleTVs automatically name themselves “AppleTV.local” for bonjour. Thus rather then ssh -1 frontrow@ip.address.here you can use ssh -1 frontrow@AppleTV.local (Capitalization is important here)

    Something else to help coders on looking for binary dependancies. There is a CLI tool called “otool”. It is part of the Apple Developer package XCode. If you run: otool -L you can see the dependancies that binary needs to function.

    Hope my 2 cents helps some one!

    Enjoy
    PatchSmyle

  • Tolga

    How can i get AFP enabled on bootup?
    i dont´t want to do it everytime manually with ssh, is there a way i can change a setting which forces ATV to start AppleFileServer by itself on every bootup???

  • http://www.monkeytroy.com monkeytroy

    Like cklapka, I cannot connect after doing this. Everything worked ok opening the appletv and setting up SSH, but I always get ‘Connection Refused’ when I try to ssh.

    my-computer-2:/dev me$ ssh -v frontrow@192.168.1.14
    OpenSSH_4.2p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 192.168.1.14 [192.168.1.14] port 22.
    debug1: connect to address 192.168.1.14 port 22: Connection refused
    ssh: connect to host 192.168.1.14 port 22: Connection refused

    Does anyone know why this is? I did the terminal copies of sshd and ssh.plist.

  • pete

    Hi,

    Like a few people above I cannot connect. However my ssh stops at ssh_exchange_identifaction. I copied sshd and ssh.plist via terminal to the OSBoot volume. Does anyone know how to fix this?

    $ ssh -vv -l frontrow 192.168.x.x
    OpenSSH_4.2p1, OpenSSL 0.9.7i 14 Oct 2005
    debug1: Reading configuration data /Users/me/.ssh/config
    debug1: Reading configuration data /etc/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to 192.168.x.x
    [192.168.x.x] port 22.
    debug1: Connection established.
    debug1: identity file /Users/me/.ssh/identity type -1
    debug1: identity file /Users/me/.ssh/id_rsa type -1
    debug1: identity file /Users/me/.ssh/id_dsa type -1
    ssh_exchange_identification: Connection closed by remote host

    -pete

  • Mizzo

    Like monkeyroy and cklapka, I also can’t connect. The connection is refused. Any help?

  • ppcuser

    Is there any possibility to enable ssh using a Powerbook?

    Greets ppcuser

  • http://monkeytroy.com MonkeyTroy

    I got it working. I had copied my ssh.plist from my macbook but I did not have ssh enabled on my macbook. So I recreated the ssh.plist on the appletv drive and copied the contents into it from the tutorial and now it works.

    BTW I personally did not need to use the -1 ssh switch to connect. Just doing ssh frontrow@myappletvip worked.

  • Pete

    Hi,

    I have copied the sshd binary to the appletv hard disk, copied ssh.plist from my
    mac (with ssh enabled). However connections are close by the server when I try to
    login.

    $ ssh -vvv frontrow@appletv
    OpenSSH_4.2p1, OpenSSL 0.9.7i 14 Oct 2005
    debug1: Reading configuration data /Users/me/.ssh/config
    debug1: Reading configuration data /etc/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to appletv [192.168.2.100] port 22.
    debug1: Connection established.
    debug1: identity file /Users/me/.ssh/identity type -1
    debug1: identity file /Users/me/.ssh/id_rsa type -1
    debug1: identity file /Users/me/.ssh/id_dsa type -1
    ssh_exchange_identification: Connection closed by remote host

    Any ideas what’s wrong with it?

  • Pete

    Solved this:

    ssh_exchange_identification: Connection closed by remote host

    Found a tip here: http://www.engadget.com/2007/04/10/how-to-play-divx-and-xvid-on-your-apple-tv/3

    chmod +x /Volumes/OSBoot/usr/sbin/sshd

    However it won’t still let me in:

    $ ssh -vvv frontrow@appletv
    OpenSSH_4.2p1, OpenSSL 0.9.7i 14 Oct 2005
    debug1: Reading configuration data /Users/me/.ssh/config
    debug1: Reading configuration data /etc/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to appletv [192.168.2.100] port 22.
    debug1: Connection established.
    debug1: identity file /Users/me/.ssh/identity type -1
    debug1: identity file /Users/me/.ssh/id_rsa type -1
    debug1: identity file /Users/me/.ssh/id_dsa type -1
    debug1: Remote protocol version 1.99, remote software version OpenSSH_4.5
    debug1: match: OpenSSH_4.5 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_4.2
    debug2: fd 3 setting O_NONBLOCK
    debug1: Miscellaneous failure
    No credentials cache found

    debug1: Miscellaneous failure
    No credentials cache found

    debug1: SSH2_MSG_KEXINIT sent
    Connection closed by 192.168.2.100

    Any ideas what’s missing?

  • Adam

    Pete —

    See #19 above.

  • rolf

    New harddrive installed and works. I used the disk utility in order the get all the files moved. Once I got an error I use toast to mount the image and copied the files.

    I followed instructions. I do have a powermac G5 and installed the intel based sshd file from a web site for people how do not have an InterMac . The entire folder is called OpenSSH-56.root and I used the mod command chmod +x /Volumes/OSBoot/usr/sbin/sshd

    I am still getting connection refused. (see below)

    ssh -vvv frontrow@192.168.0.xx
    OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to 192.168.0.xx [192.168.0.xx] port 22.
    debug1: connect to address 192.168.0.xx port 22: Connection refused
    ssh: connect to host 192.168.0.xx port 22: Connection refused

    Does anyone has an idea what I am doing wrong.

  • Pingback: iPhones4U.info » Blog Archive » Apple TV hacks coming fast and furious: VLC, SSH, VNC, Apache and more()

  • Pingback: Gøy med AppleTV | tronds betraktninger()

  • Pete

    Thanks Adam I missed that. Just typed

    ssh -1 frontrow@appletv

    and I’m in :)

  • Pingback: Checklist for the USB patch | Apple TV Hacks()

  • Pingback: USB patch released. HALLELUJAH! | Apple TV Hacks()

  • Pingback: Hack Apple And Add External USB Storage()

  • Pingback: Dive into OS X » Blog Archive » Apple TV Hacked to use an external USB drive()

  • Pingback: albertosagredo.es » Blog Archive » Hackeando el AppleTV (II)()

  • Martin

    Any help would be awesome…..I’ll stuck at this “line 63″.
    What am i doing wrong.

    Thanks in advanced.
    Martin

    mach_kernel.prelink 100% 6159KB 1.5MB/s 00:04
    Uncompressing the original ‘./mach_kernel.prelink’…
    /private/var/root/Desktop/AppleTVHacks_USB_patch/install-atvrhd.sh: line 63: ./prelink_tool/prelink_tool: No such file or directory
    Patching the original ‘./mach_kernel.prelink’…
    bspatch: kernel/kernel.uncompressed.patch: No such file or directory
    Harrys-Macbook-Pro:~ root#

  • Vaughn

    Is there a way to disable the AppleTV firewall? I cannot seem to write anything to the AppleTV drive

  • guy

    way i have
    connect to host 192.168.0.3 port 22: Connection refused
    maybe you can help me with this?

  • MR B

    I have the same problem, i have the 160gb version, and software 1.1

  • Roman

    Can I do that without opening the Apple TV by booting it from a USB drive?
    Is there a Linux distribution, which one could boot off and then mount the internal drive files systems to make the necessary changes?

  • Peter Bangkok

    Hi you nice guys.
    I have finally my NitoTV working.
    What I’m missing is a hint how I can access my files stored on my MAC. using ATV.
    I really have problems how to set up AFPoverTCP. Could somebody give me a hint how to do our where I could find a link how to do.
    Thanks

  • chinlumg

    I have the same problem
    i have connect to host show

    macs-computer-2:/ MAC$ ssh -1 -v frontrow@192.168.0.46
    OpenSSH_4.2p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 192.168.0.46 [192.168.0.46] port 22.
    debug1: Connection established.
    debug1: identity file /Users/MAC/.ssh/identity type -1
    debug1: Remote protocol version 1.99, remote software version OpenSSH_4.5
    debug1: match: OpenSSH_4.5 pat OpenSSH*
    debug1: Local version string SSH-1.5-OpenSSH_4.2
    debug1: Waiting for server public key.
    debug1: Received server public key (768 bits) and host key (2048 bits).
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
    Someone could be eavesdropping on you right now (man-in-the-middle attack)!
    It is also possible that the RSA1 host key has just been changed.
    The fingerprint for the RSA1 key sent by the remote host is
    c5:53:76:88:3c:fd:98:8c:e0:0d:aa:40:20:dd:67:f1.
    Please contact your system administrator.
    Add correct host key in /Users/MAC/.ssh/known_hosts to get rid of this message.
    Offending key in /Users/MAC/.ssh/known_hosts:1
    RSA1 host key for 192.168.0.46 has changed and you have requested strict checking.
    Host key verification failed.

    please help me~~

  • Viny

    Same problem here:

    ssh: connect to host 10.0.1.200 port 22: Connection refused

    Any solution?

  • mr_matalino

    The key is in the following line:

    Offending key in /Users/MAC/.ssh/known_hosts:1

    Navigate to that folder and delete the file (usually hidden)

  • Pingback: apple » Blog Archive » Apple TV hacks coming fast and furious: VLC, SSH, VNC, Apache and more()

  • miguel

    It doesn’t work for me.
    I copy the sshd file with the comand
    cp /usr/sbin/sshd /Volumes/OSBoot/usr/sbin/.
    and I get a read-only file system alert

    I try
    sudo mount -uw /Volumes/OSBoot/
    in order to forcet it as readwrite and I get
    “mount: unknown special file or file system /Volumes/OSBoot/.”

    Is there a way I can mount OS.dmg with read write permitions?
    I have also run
    mount -o rw OS.dmg /Volumes/OSBoot/
    and I got the error: “OS.dmg on /Volumes/OSBoot: Block device requeired”

    Does any one have a clue of what else could I do?

  • Pingback: Blog of Blogs » Blog Archive » 25+ Apple TV Plugins And Hacks()

  • Pingback: 25+个Apple TV插件和hack | mashableCN()

  • Pingback: Enabling ssh and adding plugins the easy way | Apple TV Hacks()

  • eric

    Help!
    i keep getting Connection closed by remote host.
    I have tried different way this is what i get

    Last login: Sat Nov 3 19:34:39 on ttys000
    Macintosh:~ mac$ ssh frontrow@10.0.1.200
    ssh_exchange_identification: Connection closed by remote host
    Macintosh:~ mac$ ssh -1 frontrow@10.0.1.200
    ssh_exchange_identification: Connection closed by remote host
    Macintosh:~ mac$ ssh -2 frontrow@10.0.1.200
    ssh_exchange_identification: Connection closed by remote host
    Macintosh:~ mac$ ssh -v frontrow@10.0.1.200
    OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 10.0.1.200 [10.0.1.200] port 22.
    debug1: Connection established.
    debug1: identity file /Users/mac/.ssh/identity type -1
    debug1: identity file /Users/mac/.ssh/id_rsa type -1
    debug1: identity file /Users/mac/.ssh/id_dsa type -1
    ssh_exchange_identification: Connection closed by remote host
    Macintosh:~ mac$

    I am on a 24in Imac running 10.5 I do not know what i am doing wrong. any ideas. Thanks

  • fortnighttv

    I’m getting the same thing:

    Macmini$ ssh -1v frontrow@appletv.local
    OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to appletv.local [192.168.15.100] port 22.
    debug1: Connection established.
    debug1: identity file /Users/Macmini/.ssh/identity type -1
    ssh_exchange_identification: Connection closed by remote host

    I’m using OSX 10.5. Can that be a problem?

  • eric

    I got it working, i used the sshd file from patchstick download .dmg . this worked. the 10.5 must be different

  • eric

    Now i can not get the apple file server to run. I tried sudo /usr/sbin/AppleFileServer
    then entered the password frontrow. then i get ( sudo: /usr/sbin/AppleFileServer: command not found ) any ideas. thank you

  • fortnighttv

    Yeah. Confirmed here. I had to use the sshd from the patchstick.dmg also. Now I’m in but can”t activate the Apple File server either. Someone help us!!! Please!

  • fortnighttv

    I keep getting this:
    -bash-2.05b$ sudo /usr/sbin/AppleFileServer
    sudo: /usr/sbin/AppleFileServer: command not found

  • eric

    I used Fugu to transfer filed to the apple tv. i was able to move atv loader to the home folder. Download FUGU and connect to AppleTV.local,user name frontrow and password frontrow, check force ssh1. That allowed me to move files to the apple tv. But i still can not figure out how to run the atv loader installme.
    When i try sudo ./installme it returns with command not found.
    Any ideas would help. Thank you

  • fortnighttv

    Got it! In v.1.1 the AppleFileServer app is missing. To restore the app, use these commands and voila!, you can then activate using the sudo /usr/sbin/AppleFileServer command and afp into the apple tv. Copy one line at a time.

    sudo mount -o remount,rw /dev/disk0s3 /
    cd ~
    mkdir mnt
    sudo mount -t hfs /dev/disk0s2 mnt
    hdiutil attach mnt/OS.dmg
    sudo cp -R /Volumes/OSBoot\ 1/System/Library/CoreServices/AppleFileServer.app /System/Library/CoreServices
    hdiutil detach /Volumes/OSBoot\ 1/
    sudo umount mnt
    rmdir mnt
    sudo mount -o remount,ro /dev/disk0s3 /

    I’m now able to Connect.

  • eric

    Any one know how to install ATVLoader. I have the AtvLoader folder on my apple tv in the home folder with ssh on, but i do not know how to run the install commands via ssh. Please help. Thank you.

  • Pingback: Apple Blog » Blog Archive » HOWTO Enable SSH and AFP on Apple TV()

  • Pingback: corey-m’s blog » Blog Archive » AppleTV SSH Hack()

  • Rick Abrams

    I have a great home theater system. It is based on hardware/software from a company called Control4. http://www.control4.com

    One of the best parts of the system is that I have video switching so I can watch any video signal (DVD players, cabel boxes, etc., etc.) on any tv in the house.

    I can also choose to watch apple tv and an iMac on any tv since they are also video sources on the system. After installing Leopard, the iMac video signal doesn’t work on the tv’s. We’ve been playing with displayconfigx and Switchresx but haven’t yet been able to get the iMac to send the proper resolution, etc. to the TVs.

    I very much miss watching video (from any web site) on my Tv’s. With Apple TV, I can only watch videos from iTunes which I also do but it is pretty limited.

    Since the apple tv takes care of resolutions so well, I am wondering if anyone knows how I could watch video from any website throught the Apple TV on my TV’s? If I could do this I wouldn’t need to have direct access to my iMac.

    Or if anyone can help me figure out how to get my system working again so that the iMac can work with various TV’s, I’d appreciate that too.

    Thanks in advance.
    Rick

  • Tick

    Just a heads up to those attempting to use a PPC based mac… I’ve got 10.5 running, but the sshd from that doesn’t work either.

    For whatever reason when I attach the drive with no apps open (except Finder and Dock of course) I see the two volumes mount on the desktop, and then I get a spinning pinwheel until I force poweroff the machine.

    When I boot to the install CD and open terminal from there (single user mode doesn’t autoboot the USB drive) I can access the drive no problem at all.

  • Tick

    Scrap that last post, when you run: file shhd for the sshd binary that comes on 10.5, it is compiled both for PPC and i386. The reason it wasn’t working, is I was trying to use Putty from a Windows machine using SSH2, and I guess it needed to be set to SSH1.

    So for all you PPC based users, you can use your Leopard binary :)

  • Raffi Parikian

    I followed the instructions to the T and am getting “Server Unexpectedly Closed Network Connection” Can anyone help with this?

  • gt

    is there a way to recover from the boot disk in terminal?
    My atv gets stuck at the apple logo and wont boot or allow me to ssh.

  • Guido79

    Getting the following output error:

    Macintosh-115:~ me$ ssh -vvv frontrow@10.0.1.230
    OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to 10.0.1.230 [10.0.1.230] port 22.
    debug1: Connection established.
    debug1: identity file /Users/me/.ssh/identity type -1
    debug1: identity file /Users/me/.ssh/id_rsa type -1
    debug1: identity file /Users/me/.ssh/id_dsa type -1
    ssh_exchange_identification: Connection closed by remote host

    Copied sshd from Mac OS X 10.5.2 and used plist from my Mac mini. Do I need to use a different sshd or do I need to just modify access privileges.

  • Pete

    I’ve just been trying to get this working, and had the same problems. I had no success with the 10.5.1 binary from my MacBookPro, so you may be suffering the same problems I did. I grabbed an older version from ‘Mac OS X 10.4.9 Update (Intel)’ for my Mac and grabbed the sshd from the Archive.pax.gz. (You can just download that from the apple website and extract using the ‘pax’ tool)

    I’ve also been trying to get this working on the 2.0 release, which is a great improvement with the Apple TV functionality. I’m not sure whether there’s major differences between v1.0 and v2.0, the kernel looks the similar, whether the libraries are compiled differently I don’t know at this point, i’ve not attempted to add any other software to it.

    It seems in v1.0 there were some parts of ssh still available on the ATV, namely /usr/libexec/ssh-keygen-wrapper and /usr/bin/ssh-keygen being the important files in addition to /usr/sbin/sshd. Installing /usr/sbin/sshd is covered above. Modifying ssh.plist is also covered above, though ssh.plist refers to ssh-keygen-wrapper which no longer exists in v2.0, so grab a copy from another Mac and install it into /usr/libexec. The only other binary you’ll need is /usr/bin/ssh-keygen. I just grabbed the same version as the one which was on my ATV (v1.0) previously, but if you’ve already upgraded, the quick tests I did on the version in the 10.4.9 update mentioned above seems to work fine.

    Kerberos framework is useful to allow sshv2, but again I found 10.5.1 wasn’t any good. I grabbed from 10.4.9 Update or from Security Update 2007-09, sorry, can’t remember exactly which one now. And you’ll probably want /usr/bin/scp too if you plan on copying files over ssh, that’s missing from ATV v2 too. But once you’ve got everything on there, it just works as expected.

    It’s certainly caused me to get more under the skin with Mac OSX, and I have to say it’s been a pleasant experience. launchd looks like much of an improvement over the traditional unix tools.

    Now to see if I can get MythTV frontend on this, then I can remove my linux machine, and with the features in ATV v2 i’m keen to make the switch.

    Oh, and if it’s helpful to anyone having issues here, you can always enable telnet (Copy in /usr/libexec/telnetd and modify /System/Library/LaunchDaemons/telnetd.plist and remove the 2 lines which disable it) As telnet is more simply than ssh (no encryption, and only relys on telnetd binary and no other files) its useful in allowing you to get access and find out what the issues are. Take note, did I mentioned there’s no encryption?! Fine if you’re accessing this only over your own internal LAN.

  • stever

    I recently updated my Apple TV to V2 via the normal (Apple) update, and then decided to upgrade to a Seagate 160GB drive from the original stock 40GB. I used diskutil and dd to generate the image and copy to the new drive. Everything worked great except for the last step:

    diskutil eraseVolume “Journaled HFS+” Media /dev/disk3s4
    DiskManagement setuid-tool failure
    diskutil eject disk3
    Disk disk3 ejected
    gpt show disk3
    gpt show: error: bogus map
    diskutil eject disk3
    Disk disk3 ejected
    gpt recover disk3
    gpt recover: error: bogus map

    At this point, I wimped out and bought the iPartition utility for $50. That allowed me to keep the media dir contents intact.

    Following very carefully Pete’s detailed post about the missing elements for ssh and scp in the V2 OSBoot volume, I used the public Darwin 8.0.1 iso for /usr/libexec/sshd-keygen-wrapper, /usr/bin/ssh-keygen, /usr/sbin/sshd and /usr/bin/scp. My ssh.plist was exactly as documented by Bare, and I used chown to return owner of my inserted files back to root. Finally, I removed the .Spotlight-V100 files from both volumes.

    The new drive with V2 + (hopefully ssh) booted normally and showed 144.63GB as the new media partition. But this made my evening:

    ssh -1 frontrow@appletv.local
    The authenticity of host ‘appletv.local (10.0.0.4)’ can’t be established.
    RSA1 key fingerprint is 6c:e5:4b:19:ba:a4:2c:5c:1e:0f:2d:95:29:ac:00:76.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added ‘appletv.local,10.0.0.4′ (RSA1) to the list of known hosts.
    Password:
    Response:
    Last login: Sun Feb 17 21:05:29 2008
    -bash-2.05b$ top
    -bash: top: command not found
    -bash-2.05b$ pwd
    /Users/frontrow
    -bash-2.05b$ ls -la
    total 8
    drwxr-xr-x 12 frontrow frontrow 408 Feb 17 21:05 .
    drwxrwxr-t 5 root admin 170 Feb 12 22:31 ..
    -rw-r–r– 1 frontrow frontrow 3 May 31 2001 .CFUserTextEncoding
    drwx—— 2 frontrow frontrow 68 Feb 17 21:05 .Trash
    drwx—— 3 frontrow frontrow 102 Aug 1 2006 Desktop
    drwx—— 3 frontrow frontrow 102 Aug 1 2006 Documents
    drwx—— 19 frontrow frontrow 646 Feb 12 22:33 Library
    drwx—— 3 frontrow frontrow 102 Aug 1 2006 Movies
    drwx—— 3 frontrow frontrow 102 Aug 1 2006 Music
    drwx—— 3 frontrow frontrow 102 Aug 1 2006 Pictures
    drwxr-xr-x 4 frontrow frontrow 136 Aug 1 2006 Public
    drwxr-xr-x 5 frontrow frontrow 170 Mar 14 2007 Sites
    -bash-2.05b$

    Summarizing – this is a V2 Apple TV via the official update, running ssh.

  • DavidS

    If you see this:

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

    The solution is simple. In a Terminal:

    rm ~/.ssh/known_hosts

    You could also go in and remove the individual host entries if you know how to do so. Removing the file will cause no harm however.

  • Phil

    For those getting the “ssh_exchange_identification: Connection closed by remote host” and “Server Unexpectedly Closed Network Connection” type of errors when attempting to enable ssh on a Take 2-upgraded unit, some information in this post on AwkwardTV finally got it working for me. Specifically, copying ALL of the ssh/scp/sftp files listed there (not just the subset I’d previously seen mentioned in other ssh-enabling tutorials), and duplicating the exact file permissions from a live OSX system (including setuid bits and whatnot) finally got things working.

  • Secure1

    The steps above do not appear to work on the new Macs. I was unable to find the OSboot or Volumes with the find. However, I am a bit of a newb. Is there updated instructions? I have a new intel Mac Pro Book with Applve TV ver 2

  • Secure1

    I suppose I’m a bit lost. I have followed all the steps and are unable to get this ssh to enable to continue forward. The error below is what I get every time. I have downloaded the ssh.plist and replaced the sshd with the intel version that I downloaded from the web. However, still no luck. I have even disabled the firewall. However, this doesn’t seem to be clicking. Is there anyone that can help me out here?

    coders-macbook-pro:~ SOURCE1$ ssh -1 frontrow@192.168.1.106
    ssh_exchange_identification: Connection closed by remote host

  • webofa

    System: AppleTV 2.0 non-safe update, MacbookPro

    I seem to be having the same problem as several other people, and it seems there is no “expert” available to sort some of the questions out.

    I’m ssh-ing into the machine from a 10.5.x macbook pro. I’ve used older binaries of sshd per the instructions, but there seem so be a disconnect somewhere. It’s probably simple, but I don’t understand the error code below:

    Jupiter:~ Jupiter$ ssh -vvv frontrow@192.168.1.11
    OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to 192.168.1.11 [192.168.1.11] port 22.
    debug1: Connection established.
    debug1: identity file /Users/Jupiter/.ssh/identity type -1
    debug1: identity file /Users/Jupiter/.ssh/id_rsa type -1
    debug1: identity file /Users/Jupiter/.ssh/id_dsa type -1
    debug1: Remote protocol version 2.0, remote software version OpenSSH_4.5
    debug1: match: OpenSSH_4.5 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_4.5
    debug2: fd 3 setting O_NONBLOCK
    debug1: SSH2_MSG_KEXINIT sent
    Connection closed by 192.168.1.11

    Thanks in advance if someone knows what on earth the problem is. I had the instant “Connection refused by remote host” error like some of the people above, but it was because I loaded the 10.5 sshd onto the appleTV which doesn’t work (I later read). So, I’m farther than I was before, but still a ways off.

  • Joseba

    This enable run OK with the revision 2 of AppleTV?

    Thanks.

    Joseba

  • Bret

    Help with this would be hugely appreciated…

    I bought my ATV in January and having struggling to get sshd to work ever since. I’m using an IMac with Leopard and I think my ATV is 1.1. Whenever I try ssh -1 or ssh -2, I get the “ssh_exchange_identification: connection closed by remote host” error. Please, please can someone help me?

  • http://maurice.tk mauriez

    @Bret: copy sshd-keygen-wrapper to /Volumes/OSBoot/usr/libexec.

    I was having the same problem and this did the trick.

  • Den

    @Bret : I had the same problem (meaning that the Mac I picked the files from was on Leopard) , and Stever’s tricks (cf. #100) worked perfectly fine.

    To sum up, the combination of
    – Hard Drive upgrade (160 Gb)
    – Apple TV upgrade (1.1 -> 2)
    – SSH/SCP enabling

    … seemed to work for me using exclusively Leopard (of course that’s a bit of cheating, since I Downloaded Darwin8.0.1.iso ;o) w/o iPartition (but again I had no media files)

    so, many thanks to you three, J. Bare, Stever and Pete !!

    __
    Den

    ps : the trick must have been already documented (and is not that interesting), but I couldn’t resist the temptation to edit the BootLogo picture at /System/Library/CoreServices/BootLogo.png…

  • Michael

    I need help when i try to ssh in i get Connection Closed by remote host.

    michael-hoskinss-mac-mini:~ mhoskins$ ssh frontrow@192.168.1.100
    ssh_exchange_identification: Connection closed by remote host
    michael-hoskinss-mac-mini:~ mhoskins$ ssh -1 -v frontrow@192.168.1.100
    OpenSSH_4.7p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 192.168.1.100 [192.168.1.100] port 22.
    debug1: Connection established.
    debug1: identity file /Users/mhoskins/.ssh/identity type -1
    ssh_exchange_identification: Connection closed by remote host
    michael-hoskinss-mac-mini:~ mhoskins$ ssh -v frontrow@192.168.1.100
    OpenSSH_4.7p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 192.168.1.100 [192.168.1.100] port 22.
    debug1: Connection established.
    debug1: identity file /Users/mhoskins/.ssh/identity type -1
    debug1: identity file /Users/mhoskins/.ssh/id_rsa type -1
    debug1: identity file /Users/mhoskins/.ssh/id_dsa type -1
    ssh_exchange_identification: Connection closed by remote host
    michael-hoskinss-mac-mini:~ mhoskins$ ssh -vvv frontrow@192.168.1.100
    OpenSSH_4.7p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to 192.168.1.100 [192.168.1.100] port 22.
    debug1: Connection established.
    debug1: identity file /Users/mhoskins/.ssh/identity type -1
    debug1: identity file /Users/mhoskins/.ssh/id_rsa type -1
    debug1: identity file /Users/mhoskins/.ssh/id_dsa type -1
    ssh_exchange_identification: Connection closed by remote host

  • Den

    @ Michael:

    Seeing the version of openSSH you’re using, I would say your Mac is on Leopard.
    If that is the case, have you tried Stever’s instructions (post #100) ?
    That worked perfectly fine for me.

    __
    Den

  • Michael

    @ Den

    I have copied to following files /usr/libexec/sshd-keygen-wrapper, /usr/bin/ssh-keygen, /usr/sbin/sshd and /usr/bin/scp to /Volumes/OSBoot/usr/sbin/ on my Apple tv is this correct if so I still cant connect to the apple tv. Do I need a special software or program to copy them over.

  • Michael

    progress: Now i get this when trying ssh what am I doing wrong can anyone help?

    michael-hoskinss-mac-mini:~ mhoskins$ ssh -1 frontrow@AppleTV.local
    Protocol major versions differ: 1 vs. 2
    michael-hoskinss-mac-mini:~ mhoskins$ ssh -2 frontrow@appletv.local
    Unable to negotiate a key exchange method

  • Den

    @ Michael :
    We’re getting near the end of my knowledge in openSSH “debugging” ;o)
    Did you copy these files from the right version of Darwin ? I mean, not from your 10.5 distro, but for instance from
    http://www.opensource.apple.com/darwinsource/images/darwinx86-801.iso.gz

    Also, what did you do between #112 and #113 ?

    __
    Den

  • http://zinkwazi.com/blog greg

    yay, i finally got it going.
    thanks to the guys in post 99 and 100 for filling in the missing parts needed for v2.0

  • Michael

    Its working but with one small problem I cant activate the apple file serve i get the following error:

    michael-hoskinss-mac-mini:~ mhoskins$ ssh -1 frontrow@appletv.local
    Password:
    Response:
    Last login: Fri Apr 11 18:31:51 2008
    -bash-2.05b$ sudo /usr/sbin/AppleFileServer

    We trust you have received the usual lecture from the local System
    Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

    Password:
    sudo: /usr/sbin/AppleFileServer: command not found
    -bash-2.05b$

  • http://www.1701media.com Brett

    I am running Take 2 on a brand new AppleTV box and was able to get SSH installed but can not find AppleFileServer anywhere… not on any install disks for Leopard or Tiger or anywhere else.

    Can someone please point me to where I can get the AppleFileServer file??

    Thanks

  • http://none Accu

    Hi,
    I’m facing still issues with my ATV. I have done everything as mentioned in the instructions above but I still do not get SSH working.
    I always get the following error message: “”ssh_exchange_identification: Connection closed by remote host”
    Not sure if this prob comes because I have upgraded the ATV to version 2.0.2 before I did all modifications. Any ideas?

  • Mark

    OK gang,

    I can’t figure it out. I followed steps 99 & 100 to the letter, copied the files from my old Tiger machine, altered all the ownerships and permissions, and I still get a port 22 refused error.

    Am I missing something? I read somewhere about disabling the firewall? Any ideas?

    M

  • Shaun Tilford

    Appears to be an issue with update 2.0.2 disabling ssh. I am encountering the same issues as listed with getting in…. connection is dropped by the appletv everytime.

  • Den

    Ouch

    You people are right about 2.0.2 disabling ssh: http://forum.awkwardtv.org/viewtopic.php?f=2&t=1550
    However, the replies in this post tend to indicate that the patchstick solution still looks viable.

    As for myself, I remained under 2.0.1 and then blocked the Autoupdate feature.

    In fact (this is a personal opinion, of course), I think ATV is really fun to hack (learned a lot doing it), but I must admit I rarely use it, that’s why I don’t really care about the updates ;o)

    __
    Den

  • Tom

    Hi,

    I somehow dont get the AFP running. The AppleFileServer is there but when I try to sudo it, it tells me “command not found” any help?

    Tom

  • http://flo.to floto

    hi

    i also lost every installed app/plugin an ssh/afp when i did the 2.0.2 update.

    well it took me some time, but this howto will explain everything:
    http://wiki.awkwardtv.org/wiki/Install_SSH

    2 most important things to read:

    A. you will need the sshd from the patchstick > downloadable here: http://wiki.awkwardtv.org/wiki/Patchstick/Testing#Full_Working_Version

    and is located here:
    Patchstick/Patchstick/atvloader/AwkwardTV.frappliance/Contents/Resources/sshd

    the sshd from leopard will not work!

    B. you need to copy some addition files and chown and chmod them (i did all of them and it worked fine)
    see in notes for take 2:
    http://wiki.awkwardtv.org/wiki/Install_SSH#Notes

    For example:
    sudo chown 0:0 /Volumes/OSBoot/usr/bin/ssh
    chmod 755 /Volumes/OSBoot/usr/bin/ssh

    #
    floto

  • http://flo.to floto

    hi again

    after hours of trying finally the AFP is working.

    i checked if the AppleFileServer app is on the apple tv. NO its not.

    well simple idea: get it from leopard on my macbook pro to apple tv.

    scp is not working. or i could get it to work. and i preferred to put the energy to the AFP issue instead. that’s why i had to make another build out/ build in loop of the HD of apple tv.

    1. get the HD from app tv built out again (i stopped counting how many times i did that…) and plugged it in to my USB slot on my macbook pro.
    2. copied the AppleFileServer.app to /OSBoot/System/Library/CoreServices/
    3. built in the HD again
    4. cmd K (connect to server): afp://your.appletv.IP
    5. un: frontrow / pw: frontrow

    done.

    because i wanted to try other possibilities i also copied this file:
    http://www.benmackin.com/stuff/afpinstall.sh

    from this howto:
    http://wiki.awkwardtv.org/wiki/Take_2_Full_Update

    an let it run on apple tv after logging in with ssh:
    sudo sh afpinstall.sh

    so i’m not a 100% sure which made it possible to use AFP inthe end.

    hope that helps somehow

    #
    floto

  • oohmyygoood

    Hi,

    Is physically taking out the aTV’s hard disk the only way to get access to it?

    If the aTV is on the same wireless network as the Mac, surely there must be some other way to access it over the network? I mean, iTunes IS already accessing it over the same network when syncronising.

    And Apple Core’s aTV Flash did it from an USB data key stuck into the aTV.

    Isn’t there a better way than opening the aTV and thereby compromising the warranty?

  • Mike

    I turned on the afp (Take 2 version 2.02) by using the following

    Download the afpinstall.sh
    http://www.benmackin.com/stuff/afpinstall.sh

    using terminal, copy the file to Apple TV
    scp -1 -r afpinstall.sh frontrow@appletv.local:~/

    Run the script
    ssh to Apple TV
    sudo sh afpinstall.sh

    CHEERS TO oohmyygoood!

  • Mike

    I turned on the afp (Take 2 version 2.02) by using the following

    Download the afpinstall.sh
    http://www.benmackin.com/stuff/afpinstall.sh

    using terminal, copy the file to Apple TV
    scp -1 -r afpinstall.sh frontrow@appletv.local:~/

    Run the script
    ssh to Apple TV
    sudo sh afpinstall.sh

    CHEERS TO floto !

  • brett

    I am trying to get this to work but keep getting the following output once I have run the “sudo sh afpinstall.sh”

    Mounting the drive…
    399+1 records in
    399+1 records out
    419405824 bytes transferred in 59.451415 secs (7054598 bytes/sec)
    /dev/disk1 /Volumes/Recovery
    Checksumming Driver Descriptor Map (DDM : 0)…
    Driver Descriptor Map (DDM : 0): verified CRC32 $C85953CF
    Checksumming Apple (Apple_partition_map : 1)…
    Apple (Apple_partition_map : 1): verified CRC32 $5590B43F
    Checksumming disk image (Apple_HFS : 2)…
    ……………………………………………………………………
    disk image (Apple_HFS : 2): verified CRC32 $683D3268
    Checksumming (Apple_Free : 3)…
    (Apple_Free : 3): verified CRC32 $00000000
    verified CRC32 $552DAE38
    /dev/disk2 Apple_partition_scheme
    /dev/disk2s1 Apple_partition_map
    /dev/disk2s2 Apple_HFS /Volumes/OSBoot 1
    Installing the Frameworks…
    Installing the Filesystem Extensions…
    cp: /Volumes/OSBoot 1/System/Library/Filesystems/AppleShare: No such file or directory
    Installing into CoreServices…
    cp: /Volumes/OSBoot 1/System/Library/CoreServices/AppleFileServer.app: No such file or directory
    Installing the PrivateFrameworks…
    Installing into /usr/bin…
    cp: /Volumes/OSBoot 1/usr/bin/atlookup: No such file or directory
    Installing into /usr/lib…
    cp: /Volumes/OSBoot 1/usr/lib/pam/pam_afpmount.so: No such file or directory
    Installing into /usr/sbin…
    ln: /usr/sbin/AppleFileServer: File exists
    cp: /Volumes/OSBoot 1/usr/sbin/appletalk: No such file or directory
    cp: /Volumes/OSBoot 1/usr/sbin/automount: No such file or directory
    cp: /Volumes/OSBoot 1/usr/sbin/blued: No such file or directory
    cp: /Volumes/OSBoot 1/usr/sbin/portmap: No such file or directory
    cp: /Volumes/OSBoot 1/usr/sbin/slp_reg: No such file or directory
    cp: /Volumes/OSBoot 1/usr/sbin/slpd: No such file or directory
    cp: /Volumes/OSBoot 1/usr/sbin/xinetd: No such file or directory
    Installing into /sbin…
    cp: /Volumes/OSBoot 1/sbin/mount_afp: No such file or directory
    Updating /etc/hostconfig to start AFP at boot…
    Done!

    You can see it is having a hard time finding the files – any ideas (running apple tv take 2.02)

  • Josh G.

    @Brett — the issue seems to be that the recovery partition that the script mounts from the Apple TV hard drive is expected to contain version 1.0 or 1.1 of the OS, though the unit may well be upgraded to 2.0-2.02. As far as I can tell, newer versions of Apple TV have version 2.0-2.02 of the OS on the recovery partition, and these exclude the necessary files. I’m attempting to download version 1.1 from bit torrent (only a bad copy found so far, but I think I’ve found 1.0 that is solid) and get the files from the image directly, and copy them to the correct locations (which can be seen in the script).

  • Josh G.

    Quick follow up — I did get AFP installed successfully by moving the files referenced in the shell script from the Apple TV 1.0 recover image to the locations indicated. There are two symbolic links that are created in the script, as well as the creation of a hostconfig file, which is moved and then the ownership is changed to root:wheel. I simply used the same commands create those. After a quick reboot, command-k, enter the ip address of the unit, and choose what mount point you want.

  • Julia

    I applied both the ssh and usb patches from iClarified and now everytime I plug a usb stick into the usb port to play some movies from it the AppleTV is rebooting and rebbooting again – until I remove the usb stick. Any ideas? I have ssh access and everythings seems fine (version 2.0.2) except for accessing usb drives…

  • http://kiwisail.com Stephen Bolter

    I am looking for software or someone to help me write software to replay video out of an apple TV or a mac mini, the software needs to be sheduled and made to play by serial control…

    Anyone interested ?? Stephen

  • sunil

    After doing the SSH upgrade and trying to get into ATV, I get the following error

    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to appletv.local [192.168.1.16] port 22.
    debug1: connect to address 192.168.1.16 port 22: Connection refused
    ssh: connect to host appletv.local port 22: Connection refused

    Any ideas?

  • sunil

    OpenSSH_4.7p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 192.168.1.16 [192.168.1.16] port 22.
    debug1: Connection established.
    debug1: identity file /Users/motorwerks/.ssh/identity type -1
    debug1: identity file /Users/motorwerks/.ssh/id_rsa type -1
    debug1: identity file /Users/motorwerks/.ssh/id_dsa type -1
    debug1: Remote protocol version 1.99, remote software version OpenSSH_3.8.1p1
    debug1: match: OpenSSH_3.8.1p1 pat OpenSSH_3.*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_4.7
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-cbc hmac-md5 none
    debug1: kex: client->server aes128-cbc hmac-md5 none
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024

  • sunil

    debug1: Next authentication method: publickey
    debug1: Trying private key: /Users/motorwerks/.ssh/identity
    debug1: Trying private key: /Users/motorwerks/.ssh/id_rsa
    debug1: Trying private key: /Users/motorwerks/.ssh/id_dsa
    debug1: Next authentication method: keyboard-interactive
    password:

    I enter frontrow but does not work

  • Mike

    From awkwardtv wiki:

    “As discussed in the forum, these instructions don’t quite get the full way for enabling SSH on a “Take 2″ AppleTV.

    Simply following them and trying to SSH to the AppleTV will result in an error message:

    ssh_exchange_identification: Connection closed by remote host

    In addition to copying over /usr/sbin/sshd and /System/Library/LaunchDaemons/ssh.plist per the above, the forum recommends (and I can attest to this working) also copying the following files:

    * /usr/bin/ssh
    * /usr/bin/ssh-add
    * /usr/bin/ssh-agent
    * /usr/bin/ssh-keygen
    * /usr/bin/ssh-keyscan
    * /usr/bin/scp
    * /usr/libexec/sftp-server
    * /usr/libexec/ssh-keysign
    * /usr/libexec/sshd-keygen-wrapper

    You only need to copy over /usr/libexec/sftp-server, /usr/libexec/sshd-keygen-wrapper, and the kerberos framework. The other files would be needed if you wanted to ssh out of the appletv to other devices, but not to ssh into it.

    * Note: /usr/bin/ssh-keygen is also required since this one generates the host keys first time you SSH to your AppleTV! (hence it takes a while that 1st time). ”

    http://wiki.awkwardtv.org/wiki/Install_SSH#Notes_for_Take_2

  • http://www.roulettesystemwinner.com roulette online

    roulette online

  • Rudy

    After doing the SSH upgrade and trying to get into ATV, I get the following error

    SSH v2
    ssh -v frontrow@10.20.0.13
    OpenSSH_5.1p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 10.20.0.13 [10.20.0.13] port 22.
    debug1: connect to address 10.20.0.13 port 22: Connection refused
    ssh: connect to host 10.20.0.13 port 22: Connection refused

    SSH v1
    ssh -1v frontrow@10.20.0.13
    OpenSSH_5.1p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to 10.20.0.13 [10.20.0.13] port 22.
    debug1: connect to address 10.20.0.13 port 22: Connection refused
    ssh: connect to host 10.20.0.13 port 22: Connection refused

    i also did the “chmod +x /Volumes/OSBoot/usr/sbin/sshd” and copy the
    ssh.plist from my MacBook 10.5.5. Need Help I been at it with no success

  • http://www.itsmyweb.com Rick

    Hi,

    I took apart my Apple TV last night and followed all of the instructions to enable SSH and when I tried to SSH into it using Terminal. I get a SSH exchange notifiction rejection error.

    I am running 2.3 of the Apple TV software.

    Do I need to open up a port in my Linksys Router?

    Any help is greatly appreciated.

    Thanks,

    Rick

  • K Michael

    Thanks to everyone for sharing all the good information on here.

    I was able to upgrade my original Apple TV 40GB to a new 250GB drive over the past 24 hours. In addition I was able to use the Patchstick to add Boxee and XBMC along with gaining access to my ATV via AFP with the help of afpinstall.sh script.

    Here’s my question. Prior to running the afpinstall.sh I was able to run XBMC and Boxee without any issues. Now when I launch XBMC, it starts in a window, not full screen. I tried setting the display option to Fullscreen but that just blanks the screen.

    Boxee has a similar issue. The application is running but you can see the User Interface (UI).

    I’m making an assumption that the afpinstall.sh script possibly changed some display setting which has caused this to happen.

    Has anyone else run into this problem? If so, what’s the resolution.

    Thanks!

    K Michael

  • http://electroniccigarettesmokes.com/ Electronic Cigarette

    Opening the Apple TV and connecting the hard drive to your Intel Mac are covered in the hard drive upgrade and elsewhere, so we’ll skip those steps and jump right to the point where you have the OSBoot and Media volumes mounted on your Mac.

Previous post:

Next post: