Left Menu

Howto Iphone && Linux

So, you have an Iphone and using Linux? Are you tired of Itunes and this all the time syncing? Well, we have a suggestion for you and your Iphone :) You need only two things to start using your Iphone with Linux.
1. Connect it to the router your computer is hoocked up.
2. Install SSH client to open port 22 on your device. - On a Jailbroken one is installed by default.

Now hook the Iphone to the router and check the virtual IP adress. You can check this either from the Iphone ( IF you go to Settings -> WiFi -> and click the pointer on the networks that you are on -> DHCP -> you will se the virtual IP adress ( right now mine is 192.168.1.5 )). The virtual IP adresses usually look like 192.168.*.*. If you can't find it you can always check the router's attached devices and you will see it.
After we know the IP and we have the port open we can ssh to the device ( You can check what port are open with simple port scanner like nmap). Checking for open ports :
NOTE: You will have to scan with root privileges if you want an OS detection. You can either use su to become a super user or sudo. The second one is safer, because the sudo command will let you execute commands as user with root privileges.

linnewbies.com kickar # nmap -v -A 192.168.1.5

Starting Nmap 4.76 ( http://nmap.org ) at 2009-03-25 00:07 EDT
Initiating ARP Ping Scan at 00:07
Scanning 192.168.1.5 [1 port]
Completed ARP Ping Scan at 00:07, 0.18s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 00:07
Completed Parallel DNS resolution of 1 host. at 00:07, 0.99s elapsed
Initiating SYN Stealth Scan at 00:07
Scanning 192.168.1.5 [1000 ports]
Discovered open port 22/tcp on 192.168.1.5
Discovered open port 62078/tcp on 192.168.1.5
Completed SYN Stealth Scan at 00:07, 2.83s elapsed (1000 total ports)
Initiating Service scan at 00:07
Scanning 2 services on 192.168.1.5
Completed Service scan at 00:07, 0.30s elapsed (2 services on 1 host)
Initiating OS detection (try #1) against 192.168.1.5
Host 192.168.1.5 appears to be up ... good.
Interesting ports on 192.168.1.5:
Not shown: 500 closed ports, 498 filtered ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 4.7 (protocol 2.0)
62078/tcp open tcpwrapped
MAC Address: 00:23:12:64:00:50 (Unknown)
Device type: phone
Running: Apple embedded
OS details: Apple iPhone 3G mobile phone (iPhone OS)
Uptime guess: 511.645 days (since Tue Oct 30 08:37:57 2007)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=0 (Trivial joke)
IP ID Sequence Generation: Incremental

Read data files from: /usr/share/nmap
OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.83 seconds
Raw packets sent: 1520 (67.654KB) | Rcvd: 521 (21.432KB)
linnewbies.com kickar #

Now we know that port 22 is open. We need to ssh to the device. By default the root Iphone password is alpine. I suggest that everyone change his password for a security purposes.Ok, let's get the party started.

kickar@linnewbies.com ~ $ ssh root@192.168.1.5
root@192.168.1.5's password:
localhost:~ root# passwd
Changing password for root.
New password:
Retype new password:
localhost:~ root# cd /User/Media/DCIM/100APPLE
localhost:/User/Media/DCIM/100APPLE root# dir
IMG_0001.JPG IMG_0063.JPG IMG_0130.JPG IMG_0205.THM IMG_0263.JPG
IMG_0001.THM IMG_0063.THM IMG_0131.JPG IMG_0206.JPG IMG_0263.THM
IMG_0002.JPG IMG_0064.JPG IMG_0132.JPG IMG_0206.THM IMG_0264.JPG
IMG_0002.THM IMG_0065.JPG IMG_0132.THM IMG_0207.JPG IMG_0264.THM
IMG_0003.JPG IMG_0065.THM IMG_0133.JPG IMG_0207.THM IMG_0265.JPG
IMG_0003.THM IMG_0066.JPG IMG_0134.JPG IMG_0208.JPG IMG_0265.THM
IMG_0004.JPG IMG_0066.THM IMG_0135.JPG IMG_0208.THM IMG_0266.JPG
IMG_0004.THM IMG_0074.JPG IMG_0135.THM IMG_0209.JPG IMG_0266.THM
IMG_0005.JPG IMG_0074.THM IMG_0136.JPG IMG_0209.THM IMG_0267.JPG
IMG_0005.THM IMG_0075.JPG IMG_0136.THM IMG_0210.JPG IMG_0267.THM
IMG_0006.JPG IMG_0075.THM IMG_0137.JPG IMG_0210.THM IMG_0276.JPG
IMG_0006.THM IMG_0076.JPG IMG_0137.THM IMG_0211.JPG IMG_0276.THM
IMG_0062.THM IMG_0129.JPG IMG_0205.JPG IMG_0262.THM
localhost:/User/Media/DCIM/100APPLE root#

As you can see here I ssh to the device, changed the root password ( NOTE: If you want to change the password for the user (mobile) you have to type passwd mobile ) and went to the Photos folder and browse it. If you want to copy entire directory from one Linux system to Another one, the scp command is very useful. To copy the entire folder and all its content use the -r options.
Example :

kickar@linnewbies.com ~ $ scp -r root@192.168.1.5:/User/Media/DCIM/100APPLE /home/kickar/Iphonephotos
root@192.168.1.5's password:
IMG_0001.JPG 100% 392KB 391.9KB/s 00:00
IMG_0001.THM 100% 2933 2.9KB/s 00:00
IMG_0002.JPG 100% 487KB 486.9KB/s 00:01
IMG_0002.THM 100% 5554 5.4KB/s 00:00
IMG_0003.JPG 100% 431KB 431.1KB/s 00:00
IMG_0003.THM 100% 5005 4.9KB/s 00:00
IMG_0004.JPG 100% 338KB 338.4KB/s 00:01
IMG_0004.THM 100% 3619 3.5KB/s 00:00
IMG_0005.JPG 0% 0 0.0KB/s --:-- ETA^CKilled by signal 2.
kickar@linnewbies.com ~ $
As you can see I stopped it because I already have all my photos on my Gentoo machine. scp works for everything : photos, music, pictures and so on ...... Enjoy the NEW WAY to access your wonderful device :)
NOTE: The music is under /User/Media/iTunes_Control/Music in all the directories like F00. The songs have senseless names but if you have Amarok compiled with ipod support everything will be ok once you load the songs :)


|Home | LinuXchange| Updates | Contact Us | About The Project | Unique Visitors| Sponsorship|