IPhone
Contents |
About
The iPhone from Apple is a device capable of playing music with a good audio quality and a good mobile phone. In this guide you'll learn how to connect it to Amarok using OpenSSH on the phone and to manage the audio collection of the device.
Connection
You should connect the iPhone at a wireless network so that you can access it's IP from the remote PC, I.E. To the same router of your Computer. Then on the iphone, go to:
| Code: |
Settings -> Wi-Fi -> YourNetwork -> |
And read the IP address of the iphone, i.e. 192.168.1.100
Now, on the PC:
ssh root@192.168.1.100
It will prompt for a password, enter alpine and hit enter.
Changing the root password
Ok, now you're in the iPhone. First of all you should change the root password, cause it's a bit unsafe now. You shouldn't use passwd cause it's buggy, so we're going to generate the password on the PC and write it manually in the iphone.
perl -e 'print crypt("yourpassword", "/s");'
This will return something like /sM0V04hwjBp2 , you should copy it and paste in the /etc/master.passwd file of the iphone, removing the old one for root and mobile.
nano /etc/master.passwd
Passwordless login
Now your iPhone is safe, but you can't enter the password anytime you link it to Amarok, so we should setup a passwordless login for your PC. this is done with RSA authentication.
First of all you have to enable RSA Authentication on the iphone, so in the iphone go and edit /etc/sshd_config.
nano /etc/sshd_config
Uncomment the following lines:
| Code: |
RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys |
Save and exit.
Now you need an rsa key pair, on the PC you can generate it using ssh-keygen, remember to not assign a password to it, or it will be useless, also you have to do this with the user that will use Amarok.
| Code: |
ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa): {hit enter}
Enter passphrase (empty for no passphrase): {hit enter}
Enter same passphrase again: {hit enter}
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
e6:90:cc:41:ae:f0:98:3e:5d:66:1a:33:d0:21:72:08 user@localhost
|
The next step, is to copy it on the iPhone, this is easily done (Remember to set the right ip for your iphone):
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.1.100
Now enter your password and you should be done. Try to connect to the iphone using ssh, if it doesn't ask a password you can skip to the next paragraph, else you probably have ste's openssh, and you have to do some more steps on the iphone:
| Code: |
cd ~ mv .ssh/authorized_keys .ssh/authorized_keys2 chmod 755 /var/root chmod 700 /var/root/.ssh chmod 644 /var/root/.ssh/authorized_keys |
Reboot the iPhone and it should work. if it doesn't go to the troubleshooting section.
Check for the iTunes directory
The iPhone can save the Media directory (With the itunes library) in /var/root or in /var/mobile, you should check now where it's and take note.
/var/root is used by the iPhone firmware 1.1.2 and below /var/mobile is used by the firmware 1.1.3 and above
FUSE and sshfs
Ok, now you have full access to the iPhone, but Amarok can't connect to it directly over SSH, it needs the iPhone to be mounted on the PC like a normal device. It's rather easy to do, using FUSE And sshfs which mounts a remote ssh device like a normal device.
Kernel
FUSE have to be compiled in the kernel (Or as a module autoloaded using modules.autoload.d), so you have to select it:
| Linux Kernel Configuration: kernel configuration |
File systems ---> <*> Filesystem in Userspace support |
Install
Next, you have to emerge Fuse and sshfs:
emerge -av sys-fs/fuse sys-fs/sshfs-fuse}}
Mount
Now, we need to configure sshfs to be used by a normal user, so we need to set (as root) the right permissions to /usr/bin/fusermount.
chmod 4755 /usr/bin/fusermount
We need to make (As user) the mountpoint.
mkdir ~/iphone
Test
Finally, let's try to mount the iPhone. Remember to use the right Media directory previously individuated and the right iPhone IP!
sshfs mobile@192.168.1.100:/var/mobile/Media ~/iphone
Amarok
Recompile with iPod USE flag
That's easy, you just need to add the ipod use flag to /etc/make.conf or to emerge amarok using this command:
echo "media-sound/amarok ipod" >> /etc/portage/package.use emerge media-sound/amarok
Setup the iPod link in the iPhone
(Note! The instructions in this paragraph are no longer relevant. You can safely leave this step out.) Amarok doesn't know the new iTunes directory present in the iPhone, so we need to link it to the old iPod_Control, remember to use the right Media path.
ln -s iTunes_Control iPod_Control
Select your GUI of choice for syncing your media library: gtkpod or Amarok
gtkpod
Emerge gtkpod:
emerge gtkpod
Mount your iThing:
sudo modprobe fuse; sshfs ~/iphone mobile@192.168.x.x:/var/mobile
Run gtkpod:
host ~ $ gtkpod
Click things
clickclickclickclick (the interface is pretty intuitive), just hit save once you're done and it'll begin the wireless sync
Amarok
Oo.et.oO 17:32, 5 September 2008 (UTC) note: amarok did NOT work correctly when trying to add songs to a previously songless iphone. the songs appeared in the seemingly correct itunes dirs:
iTunes_Control/Music/F*
but the ipod app on the iphone couldn't see them. in addition when connected back to my windows itunes it reported that it could not read from the iphone at all and wanted me to restore all settings. i deleted the iTunes_Control directory and itunes could see the phone again. i'm going to try putting a few songs on the iphone from itunes first and see what happens. perhaps the iphone db is a bit different than standard ipods and i need to update libgpod? i'll check back later.
We're almost done, the amarok configuration is pretty simple. Open Amarok, Go to Settings, Configure Amarok, Devices and click to "Add a device..."
Select as a plugin "Apple iPod" As name, any name, like "iPhone" As a mount point, "/home/youruser/iphone"
Now save it and go to configure, setting this as a pre-connection command:
sshfs mobile@192.168.1.104:/var/mobile/Media /home/youruser/iphone
and this as post-disconnection command:
fusermount -u /home/youruser/iphone
Restart Amarok and you're done.
Troubleshooting
Asked for a password when using passwordless setup
- Check your local ~/.ssh/id_rsa.pub file and compare it with the ~/.ssh/authenticated_keys file on your device. Does any entry match? If not, try the ssh-copy-id command again. Alternatively, just copy the contents of your id_rsa.pub file and paste it on a line of its own in authenticated_keys. Entries 'must' be one line only.
- Did you properly input and save the changes to /etc/sshd_conf?
- Did you reboot the iPod or iPhone after changing /etc/sshd_conf?
- If you used a tool other than ssh-copy-id, check the permissions for your SSH files. If you type the following command, it should look like this:
# ls -al ~/.ssh total 4 drwxr-xr-x 2 root wheel 102 Nov 21 04:25 . drwxr-xr-x 6 root wheel 306 Nov 20 00:02 .. -rw-r--r-- 1 root wheel 395 Nov 20 03:01 authorized_keys
sshfs returns "fusermount: mount failed: Operation not permitted"
Check if the /usr partition (The root partition if you doesn't have any /usr partition) is mounted with the "user" option in fstab, which implies "nosuid". Those options must be removed.
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and list their apartments, townhouses and units.
