iphone backup via ssh
- August 10th, 2010
- Write comment

Yes, i know itunes keeps backups of the iphone contents but really, i didn’t want to trust an application and take the risk to loose my contacts, sms, and so on, especially when i was going to do something not expected by that application ( yes, i’m talking of the jailbreak
So, since my iphone was already out of jail, i was able to login via ssh into the device system. It simply keep all of your stuffs in (sqlite) databases and folders, so if you know where-is-what the backup process is really simple. So i wrote a simple shell script to do the backup, and here it is. In order to use it, you should:
- Mkdir the backup folder you wish to use and copy the script inside
- Connect your iphone to a network reachable from the machine you are going to run the script from
- Fill the IPHONE_ADDRESS field with the ip address on the given network assigned to the iphone
- Toggle flags to decide what you want to backup or not
- Run the script
You should also ( if you did not before ) append your public rsa id to your iphone root ‘authorized_keys’ file in order to avoid being prompted for password at each step, as explained in this previous entry.
I did this as root, but you may try running it as mobile if you wish, just replace any root@ with mobile@ using vim or sed ‘s/root@/mobile@/g’.
Also, this is a good chance ( to add the security tag
) to remember you, jailbreaked iphone users, to change the default ssh “alpine” password, because otherwise, if you connect to untrusted (public) networks with the ssh daemon running, stealing all of your personal data may be easy as running this script
( If your first thought is “they won’t know my ip!”, give up: a simple nmap scan will reveal you quickly and easily )
You can download the script here


