Tuesday, February 01, 2011

SSH Not Working on iPhone?

Take note this is for jailbroken iPhones only.

Sometimes even though you have OpenSSH configured properly and have Automatic SSH installed on your iPhone, you may tend to lose SSH connectivity to your phone. As such is the world of IT ;-) especially when you get hit with a virus or some other program tend to screw your phone up.

You can always reinstall OpenSSH and Automatic SSH but the fix is lost after a reboot.

You can try the following to see if that restores your SSH before actually doing a hard reset or restore (if you never restored your phone before ... you are in for a long journey ... for me I did it way too many times in January 2011).

rm /System/Library/LaunchDaemons/com.ikey.bbot.plist
rm /bin/poc-bbot
rm /bin/sshpass

You can also try doing the following. Make sure you are root before doing this and that you already have MobileTerminal installed. As a practice and as an iPhone power user, ALWAYS install MobileTerminal as the first non-Cydia stock apps. And personally for me, I payed for an application called iFile (yes ... I know there are cracked versions but if you don't support good developers, you are just going to waste their efforts!) which made navigation and editing 10x easier!

Edit /etc/ssh/sshd_config and change the line


#ClientAliveInterval 0


ClientAliveInterval 60

According to man sshd_config, this line,

Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. This option applies to protocol version 2 only.

Restart the sshd daemon or better yet, reboot your iPhone for it to take effect.

Good luck!

No comments: