Ste Packaging

No more iPHUCing around.

OpenSSH

What is this?

This is a repackaging, for the iPhone Installer.app program, of this binary package for a different iPhone application installer program. I have also tweaked it a tiny bit.

Prerequisites:

In order to install this package, you need two things: the latest version of Installer.app and you must have the “BSD Subsystem” package already installed.

Will this kill my battery?

No. Unlike other ssh packages for the iPhone, this package does not have a constantly running daemon. It is simply added to the list of connections that the inetd daemon (which always runs on your iPhone) listens for. If it sees you trying to connect, it will start up sshd to handle it. When you disconnect, the sshd process goes away. This is exactly how it runs on Apple laptops. So, no, this package will not kill your battery if left turned on because, in truth, there is nothing actually running. My package is the only one that can claim this, to the best of my knowledge.

The first time you login via ssh:

The host keys are generated the first time you login via ssh, after doing a clean install of the package. This means your first login will take approximately 30-35 seconds, but after that you will find that logins are quick.

Changing your password:

You should change your password, after you install OpenSSH. Everyone knows the default password, which is “dottie”, prior to 1.1.1 and “alpine” in 1.1.1. Simply login to your iPhone, via ssh and run the “passwd” command (without the quotes). You should change your password even if you plan to enable/disable sshd on demand. Changing your password will not interfere with syncing with iTunes or with installing firmware updates from Apple.

Enabling/Disabling sshd:

Install the UIctl application and use it to do the “load -w” and “unload -w” functions on the com.openssh.sshd list entry. NOTE: don’t mess with any of the other items on the list unless you know exactly what you’re doing.

Getting keys to work

(If someone will tell me how Windows users should do this, I’ll post it here.)

Create your ~/.ssh/id_rsa.pub and/or ~/.ssh/id_dsa.pub files, on your Mac. Put a copy of it/them in ~/.ssh/authorized_keys2 on the iPhone. Then run these on your iPhone:

chmod 755 /var/root
chmod 700 /var/root/.ssh
chmod 644 /var/root/.ssh/authorized_keys2

You can generate keys on the iPhone, for use with remote servers, too.

Files & Directories added or created by this package:

/Library/LaunchDaemons/com.openssh.sshd.plist
/etc/ssh_config
/etc/ssh_host_dsa_key
/etc/ssh_host_dsa_key.pub
/etc/ssh_host_key
/etc/ssh_host_key.pub
/etc/ssh_host_rsa_key
/etc/ssh_host_rsa_key.pub
/etc/sshd_config
/usr/bin/scp
/usr/bin/sftp
/usr/bin/ssh
/usr/bin/ssh-add
/usr/bin/ssh-agent
/usr/bin/ssh-keygen
/usr/bin/ssh-keyscan
/usr/libexec/sftp-server
/usr/libexec/ssh-keysign
/usr/libexec/ssh-rand-helper
/usr/libexec/sshd-keygen-wrapper
/usr/sbin/sshd

Changelog

4.6p1-1

I replaced the com.openssh.sshd.plist file with the one from my Mac. I also added the sshd-keygen-wrapper file from my Mac. What this means is that ssh will properly start up and shutdown now and ssh can easily be enabled/disabled. The reboot of your iPhone during the upgrade to this version should be the last time it’s needed and that requirement will go away with the next version. For folks doing a new install of this package: the host keys are no longer generated during package installation. They will be generated when you first try to ssh into your iPhone. That means that first login will take longer than usual (approximately 30-35 seconds), but after that, login times will be quick.

4.6p1

This is a completely new package. It turns out the previous version wasn’t even really OpenSSH, but a different ssh distribution altogether. This package is OpenSSH, now and it’s the latest version of it.

3.2.9.1-3

Fixed an issue (with the plist file) that prevented someone from updating from -1 to -2. Also changed a setting in /etc/sshd2_config (set “ResolveClientHostName” to “no”), which gets you to the initial password prompt quicker (thanks, Quinn_Storm).

3.2.9.1-2

Fixed a problem preventing the scp client from working (renamed ssh, scp & sftp back to thier original names (with the “2″) and made symlinks to them (without the “2″).

3.2.9.1-1

Initial release. Renamed ssh2, scp2 & sftp2 to ssh, scp & sftp, so as to be more user-friendly. Added scp from iphone-binkit, as scp1, which was needed to make scp work. Fixed a typo in sshd2_config - it was looking for sftp-server and it should have been looking for sftp-server2.