个人工具

“UbuntuHelp:PortableDevices/iPhone”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/PortableDevices/iPhone}} {{Languages|UbuntuHelp:PortableDevices/iPhone}} == Using an iPhone or iPod Touch on Ubuntu == '''Disclaimer:''' Making ...)
 
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/PortableDevices/iPhone}}
 
{{From|https://help.ubuntu.com/community/PortableDevices/iPhone}}
 
{{Languages|UbuntuHelp:PortableDevices/iPhone}}
 
{{Languages|UbuntuHelp:PortableDevices/iPhone}}
== Using an iPhone or iPod Touch on Ubuntu ==
+
== Setup iPod Touch or iPhone ==
 
+
 
'''Disclaimer:'''  Making unsupported changes to your iPhone / iPod Touch could result in data loss and possibly void your warranty.  Follow this howto with care.
 
'''Disclaimer:'''  Making unsupported changes to your iPhone / iPod Touch could result in data loss and possibly void your warranty.  Follow this howto with care.
 
 
=== Determine your Firmware Version ===
 
=== Determine your Firmware Version ===
 
Follow this wiki page for information on how to properly jailbreak.
 
Follow this wiki page for information on how to properly jailbreak.
 
* [http://www.touchdev.net/wiki/How_to_Escape_Jail]
 
* [http://www.touchdev.net/wiki/How_to_Escape_Jail]
 
 
It has directions for both 1.1.1 and 1.1.2 firmwares.  Note that if you want to keep firmware 1.1.2, you may need a Mac or Windows machine to assist you.
 
It has directions for both 1.1.1 and 1.1.2 firmwares.  Note that if you want to keep firmware 1.1.2, you may need a Mac or Windows machine to assist you.
 
 
=== OpenSSH ===
 
=== OpenSSH ===
 
Once you've jailbroken your phone you'll need to install OpenSSH.
 
Once you've jailbroken your phone you'll need to install OpenSSH.
 
+
* Navigate to the Installer.app icon that is now on your springboard home screen.
*Navigate to the Installer.app icon that is now on your springboard home screen.
+
* Scroll down and click on ''System''
*Scroll down and click on ''System''
+
* Click on ''OpenSSH''
*Click on ''OpenSSH''
+
* Click on ''Install''
*Click on ''Install''
+
=== BSD Utils ===
 
+
Also, after you've jailbroken your phone you'll need the BSD utility set.
 
+
* Navigate to the Installer.app icon on your springboard home screen.
=== SSHFS ===
+
* Scroll down and click on ''System''
 +
* Click on ''BSD Subsystem''
 +
* Click on ''Install''
 +
== Set up Ubuntu ==
 +
== Passwordless Login ==
 +
When you mount your device (by running sshfs), you're required to supply your password to login. This makes it impossible for applications such as Amarok to perform the mount on demand - as in, connect - since it doesn't take the password prompt into consideration. You need a passwordless login for that!
 +
First, you want to generate a private and a public passkey, if you don't have one already. Enter this command on your local machine (not in an ssh session to your device), accept the default location, and don't enter any passphrase.
 +
<pre><nowiki>
 +
ssh-keygen -t rsa
 +
</nowiki></pre>
 +
This will create a directory called .ssh in your home directory, and place three files in there: id_rsa, id_rsa.pub, and known_hosts. id_rsa is your private keyfile, and id_rsa.pub is your public one. You want your device to have the public key so you can authenticate towards it with your private one. After entering this next command, if it asks if you want to accept the untrusted device as a trusted host, do so.
 +
<pre><nowiki>
 +
ssh-copy-id -i ~/.ssh/id_rsa.pub root@<device ip>
 +
</nowiki></pre>
 +
This will copy your public keyfile and place it into /var/root/.ssh/authenticated_keys on your device, creating it if necessary. Now log back in.
 +
<pre><nowiki>
 +
ssh root@<device ip>
 +
</nowiki></pre>
 +
Don't worry if it asks for your password; at this point, it still should. Feel free to view the contents in the authenticated_keys file and compare to your own id_rsa.pub file, if you wish. Don't log out yet.
 +
<pre><nowiki>
 +
chmod 0755 ~ ~/.ssh
 +
chmod 0644 ~/.ssh/*
 +
</nowiki></pre>
 +
Do this while still logged in. This will set up the permissions the ssh daemon requires to read root's authenticated keys. Next we'll configure some settings.
 +
<pre><nowiki>
 +
nano /etc/sshd_config
 +
</nowiki></pre>
 +
If you aren't familiar with nano, now's a good opportunity to get to know it better.
 +
Scroll down to the segment beginning with '#RSAAuthentication', and set it up as follows:
 +
<pre><nowiki>
 +
RSAAuthentication yes
 +
PubkeyAuthentication yes
 +
AuthorizedKeysFile %h/.ssh/authorized_keys
 +
</nowiki></pre>
 +
Be sure to remove any hashmarks (#) at the beginning of those three lines, or else they won't be read.
 +
Hit Ctrl+O to save, and Ctrl+X to exit.
 +
At this point you should be finished. Reboot your device.
 +
<pre><nowiki>
 +
reboot
 +
</nowiki></pre>
 +
If you're confident you've given it time enough to start up, try logging back in. Hopefully, without supplying any password.
 +
<pre><nowiki>
 +
ssh root@<device ip>
 +
</nowiki></pre>
 +
If it still doesn't work:
 +
* 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?
 +
* And you did reboot it, right?
 +
* Check those permissions we changed on certain directories on the device. If you type the following command, it should look like this:
 +
<pre><nowiki>
 +
# 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
 +
</nowiki></pre>
 +
=== ipod-convenience (Automatic Method) ===
 +
For Gutsy users, an application is stored on a PPA (personal package archive) that can be used for properly mounting and unmounting an iPhone or iPod touch so that artwork will work.
 +
<pre><nowiki>
 +
deb http://ppa.launchpad.net/ipod-touch/ubuntu gutsy main
 +
</nowiki></pre>
 +
Add that repository to your /etc/apt/sources.list.
 +
Update your apt database
 +
<pre><nowiki>
 +
sudo apt-get update && sudo apt-get upgrade
 +
</nowiki></pre>
 +
Install ipod-convenience
 +
<pre><nowiki>
 +
sudo apt-get install ipod-convenience
 +
</nowiki></pre>
 +
To mount your device use this command:
 +
<pre><nowiki>
 +
iphone-mount
 +
</nowiki></pre>
 +
To unmount your device, use this command:
 +
<pre><nowiki>
 +
iphone-umount
 +
</nowiki></pre>
 +
=== Manual Method ===
 +
Note: this method is a bit more convoluted, time consuming and prone to errors.
 +
==== SSHFS ====
 
This is what lets you mount ssh filesystems, we'll use this to mount our iphone.
 
This is what lets you mount ssh filesystems, we'll use this to mount our iphone.
 
 
Install sshfs:   
 
Install sshfs:   
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install sshfs
 
sudo apt-get install sshfs
 
</nowiki></pre>  
 
</nowiki></pre>  
 
 
Create a mountpoint:   
 
Create a mountpoint:   
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo mkdir /media/ipod
 
sudo mkdir /media/ipod
 
</nowiki></pre>  
 
</nowiki></pre>  
 
 
Change read/write access to it:  
 
Change read/write access to it:  
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo chown <username> /media/ipod
 
sudo chown <username> /media/ipod
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Add your user to the "fuse" user group:   
 
Add your user to the "fuse" user group:   
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo adduser <username> fuse
 
sudo adduser <username> fuse
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Log out and back in again (this is necessary for your user group to be taken into account).
 
Log out and back in again (this is necessary for your user group to be taken into account).
 
 
=== Determine your Firewire GUID ===
 
=== Determine your Firewire GUID ===
 
The iPod Touch requires you to create a file that is used when generating the iTunesDB and ArtworkDB which store the information of which files are on the iPod. This is not necessary for the iPhone.
 
The iPod Touch requires you to create a file that is used when generating the iTunesDB and ArtworkDB which store the information of which files are on the iPod. This is not necessary for the iPhone.
 
 
==== Find Firewire GUID ====
 
==== Find Firewire GUID ====
 
Plug in your iPod Touch or iPhone and run this command:
 
Plug in your iPod Touch or iPhone and run this command:
 
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo lsusb -v | grep -i Serial
 
sudo lsusb -v | grep -i Serial
 
</nowiki></pre>
 
</nowiki></pre>
 
 
You will receive an output similar to this:
 
You will receive an output similar to this:
 
 
<pre><nowiki>
 
<pre><nowiki>
 
iSerial                3 8089e2ce5193625c38813ec10fad4032ec839c02
 
iSerial                3 8089e2ce5193625c38813ec10fad4032ec839c02
 
 
iSerial                1 0000:00:1d.7
 
iSerial                1 0000:00:1d.7
 
 
iSerial                1 0000:00:1d.2
 
iSerial                1 0000:00:1d.2
 
 
iSerial                1 0000:00:1d.1
 
iSerial                1 0000:00:1d.1
 
 
iSerial                1 0000:00:1d.0
 
iSerial                1 0000:00:1d.0
 
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Now what you are interested in is the first 16 characters of that really long string.  This is the Firewire GUID.
 
Now what you are interested in is the first 16 characters of that really long string.  This is the Firewire GUID.
 
 
==== Place Firewire GUID in iPhone or iPod Touch ====
 
==== Place Firewire GUID in iPhone or iPod Touch ====
 
Go to the wifi settings on your iphone. tap the blue arrow next to your SSID, so that you can see your iphone's IP address. Note it down somewhere.
 
Go to the wifi settings on your iphone. tap the blue arrow next to your SSID, so that you can see your iphone's IP address. Note it down somewhere.
 
 
SSH into your device.
 
SSH into your device.
 
The first time you do this it may take up to 30 seconds to generate the SSH keys. When prompted, the default password is ''dottie'' in pre firmware version 1.1.1 and ''alpine'' in 1.1.1.  With firmware 1.1.2, you will generally have set your root address already.
 
The first time you do this it may take up to 30 seconds to generate the SSH keys. When prompted, the default password is ''dottie'' in pre firmware version 1.1.1 and ''alpine'' in 1.1.1.  With firmware 1.1.2, you will generally have set your root address already.
第80行: 第138行:
 
ssh root@<your device's ip address>
 
ssh root@<your device's ip address>
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Create the directory structure if necessary
 
Create the directory structure if necessary
 
<pre><nowiki>
 
<pre><nowiki>
 
mkdir -p /var/root/Media/iTunes_Control/Device
 
mkdir -p /var/root/Media/iTunes_Control/Device
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Create the file for the GUID.  Be sure to replace the 16 character string you found with the one after the 0x in this example.
 
Create the file for the GUID.  Be sure to replace the 16 character string you found with the one after the 0x in this example.
 
<pre><nowiki>
 
<pre><nowiki>
 
echo "FirewireGuid: 0x8089e2ce5193625c" > /var/root/Media/iTunes_Control/Device/SysInfo
 
echo "FirewireGuid: 0x8089e2ce5193625c" > /var/root/Media/iTunes_Control/Device/SysInfo
 
</nowiki></pre>
 
</nowiki></pre>
 
+
==== Symbolic Linking ====
=== Symbolic Linking ===
+
 
*Go to your general settings and set "auto-lock" to "never".  The iphone closes the wifi connection when it's locked.
 
*Go to your general settings and set "auto-lock" to "never".  The iphone closes the wifi connection when it's locked.
 
*SSH back into the iPod.
 
*SSH back into the iPod.
 
*If you didn't change your password on your iphone it is highly recommended that you do it now with the <code><nowiki>passwd</nowiki></code> command.
 
*If you didn't change your password on your iphone it is highly recommended that you do it now with the <code><nowiki>passwd</nowiki></code> command.
 
 
Move to where the iTunes library is:   
 
Move to where the iTunes library is:   
 
<pre><nowiki>
 
<pre><nowiki>
第108行: 第162行:
 
ln -s iTunes_Control iPod_Control
 
ln -s iTunes_Control iPod_Control
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Get out of the iphone.  
 
Get out of the iphone.  
 
<pre><nowiki>
 
<pre><nowiki>
 
exit
 
exit
 
</nowiki></pre>
 
</nowiki></pre>
 
+
==== Mount iPhone ====
=== Mount iPhone ===
+
 
In ubuntu now, we need to actually perform the mount!  
 
In ubuntu now, we need to actually perform the mount!  
 
<pre><nowiki>
 
<pre><nowiki>
 
sshfs root@<iphone's ip address>:/var/root/Media/ /media/ipod/
 
sshfs root@<iphone's ip address>:/var/root/Media/ /media/ipod/
 
</nowiki></pre>
 
</nowiki></pre>
 
=== Passwordless Login ===
 
 
When you mount your device manually (by running sshfs), you're required to supply your password to login. This makes it impossible for applications such as Amarok to perform the mount on demand - as in, connect - since it doesn't take the password prompt into consideration. You need a passwordless login for that!
 
 
First, you want to generate a private and a public passkey, if you don't have one already. Enter this command on your local machine (not in an ssh session to your device), accept the default location, and don't enter any passphrase.
 
 
<pre><nowiki>
 
ssh-keygen -t rsa
 
</nowiki></pre>
 
This will create a directory called .ssh in your home directory, and place three files in there: id_rsa, id_rsa.pub, and known_hosts. id_rsa is your private keyfile, and id_rsa.pub is your public one. You want your device to have the public key so you can authenticate towards it with your private one. After entering this next command, if it asks if you want to accept the untrusted device as a trusted host, do so.
 
 
<pre><nowiki>
 
ssh-copy-id -i ~/.ssh/id_rsa.pub root@<device ip>
 
</nowiki></pre>
 
This will copy your public keyfile and place it into /var/root/.ssh/authenticated_keys on your device, creating it if necessary. Now log back in.
 
 
<pre><nowiki>
 
ssh root@<device ip>
 
</nowiki></pre>
 
Don't worry if it asks for your password; at this point, it still should. Feel free to view the contents in the authenticated_keys file and compare to your own id_rsa.pub file, if you wish. Don't log out yet.
 
 
<pre><nowiki>
 
chmod 0755 ~ ~/.ssh
 
chmod 0644 ~/.ssh/*
 
</nowiki></pre>
 
Do this while still logged in. This will set up the permissions the ssh daemon requires to read root's authenticated keys. Next we'll configure some settings.
 
 
<pre><nowiki>
 
nano /etc/sshd_config
 
</nowiki></pre>
 
If you aren't familiar with nano, now's a good opportunity to get to know it better.
 
 
Scroll down to the segment beginning with '#RSAAuthentication', and set it up as follows:
 
<pre><nowiki>
 
RSAAuthentication yes
 
PubkeyAuthentication yes
 
AuthorizedKeysFile %h/.ssh/authorized_keys
 
</nowiki></pre>
 
Be sure to remove any hashmarks (#) at the beginning of those three lines, or else they won't be read.
 
Hit Ctrl+O to save, and Ctrl+X to exit.
 
 
At this point you should be finished. Reboot your device.
 
<pre><nowiki>
 
reboot
 
</nowiki></pre>
 
If you're confident you've given it time enough to start up, try logging back in. Hopefully, without supplying any password.
 
<pre><nowiki>
 
ssh root@<device ip>
 
</nowiki></pre>
 
 
If it still doesn't work:
 
* 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?
 
* And you did reboot it, right?
 
* Check those permissions we changed on certain directories on the device. If you type the following command, it should look like this:
 
<pre><nowiki>
 
# 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
 
</nowiki></pre>
 
 
 
=== Amarok ===
 
=== Amarok ===
 
Amarok seems to manage the iPod touch and iPhone much nicer than gtkpod, but this is a matter of preference.
 
Amarok seems to manage the iPod touch and iPhone much nicer than gtkpod, but this is a matter of preference.
第190行: 第178行:
 
</nowiki></pre>
 
</nowiki></pre>
 
Add that repository to your /etc/apt/sources.list.
 
Add that repository to your /etc/apt/sources.list.
 
 
Update your apt database
 
Update your apt database
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get update && sudo apt-get upgrade
 
sudo apt-get update && sudo apt-get upgrade
 
</nowiki></pre>
 
</nowiki></pre>
 
 
If you don't have gtkpod, install it now:   
 
If you don't have gtkpod, install it now:   
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install amarok ipodslave
 
sudo apt-get install amarok ipodslave
 
</nowiki></pre>
 
</nowiki></pre>
 
 
When you first open up Amarok, Click Settings->Configure Amarok.
 
When you first open up Amarok, Click Settings->Configure Amarok.
 
Choose Media Devices.
 
Choose Media Devices.
 
Hit Add Device.
 
Hit Add Device.
 
Point it at your mount point, /media/ipod.
 
Point it at your mount point, /media/ipod.
 
 
You should now be able to Connect & Transfer with no problems.  Be *sure* to disconnect when done so that the database is properly written out.
 
You should now be able to Connect & Transfer with no problems.  Be *sure* to disconnect when done so that the database is properly written out.
 
 
 
==== Automatic Mounting ====
 
==== Automatic Mounting ====
 
 
If you have configured your iPhone or iPod Touch for passwordless login via ssh, you can do this.  Otherwise do that first.
 
If you have configured your iPhone or iPod Touch for passwordless login via ssh, you can do this.  Otherwise do that first.
 
For the Pre-Connect Command in the settings, add this:
 
For the Pre-Connect Command in the settings, add this:
第216行: 第197行:
 
sshfs root@ipod:/var/root/Media /media/ipod -o uid=1000
 
sshfs root@ipod:/var/root/Media /media/ipod -o uid=1000
 
</nowiki></pre>
 
</nowiki></pre>
 
 
For the Post-Disconnect Command, add this:
 
For the Post-Disconnect Command, add this:
 
<pre><nowiki>
 
<pre><nowiki>
 
fusermount /media/ipod -u
 
fusermount /media/ipod -u
 
</nowiki></pre>
 
</nowiki></pre>
 
 
 
=== gtkpod ===
 
=== gtkpod ===
 
The version of gtkpod in the archives does not properly handle newer devices.  There is a version on this PPA (personal package archive) that does.
 
The version of gtkpod in the archives does not properly handle newer devices.  There is a version on this PPA (personal package archive) that does.
第229行: 第207行:
 
</nowiki></pre>
 
</nowiki></pre>
 
Add that repository to your /etc/apt/sources.list.
 
Add that repository to your /etc/apt/sources.list.
 
 
Update your apt database
 
Update your apt database
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get update && sudo apt-get upgrade
 
sudo apt-get update && sudo apt-get upgrade
 
</nowiki></pre>
 
</nowiki></pre>
 
 
If you don't have gtkpod, install it now:   
 
If you don't have gtkpod, install it now:   
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install gtkpod
 
sudo apt-get install gtkpod
 
</nowiki></pre>
 
</nowiki></pre>
 
 
When you first open gtkpod you may receive some errors.  Simply click OK to proceed.  Your iPhone or iPod Touch should now appear in gtkpod.  If it doesn't, you can manually add it's mount point in the options dialog.
 
When you first open gtkpod you may receive some errors.  Simply click OK to proceed.  Your iPhone or iPod Touch should now appear in gtkpod.  If it doesn't, you can manually add it's mount point in the options dialog.
 
 
Simply add music to the iPhone or iPod Touch like you would any other iPod and ''Save Changes'' when done.
 
Simply add music to the iPhone or iPod Touch like you would any other iPod and ''Save Changes'' when done.
 
+
If you aren't using ipod-convenience, you'll need to kill the iPod app for the track changes to take affect.  To do this:
You'll need to kill the iPod app for the track changes to take affect.  To do this:
+
 
*Tap the iPod app then hold down the home key for 5+ seconds until you are returned to the springboard.
 
*Tap the iPod app then hold down the home key for 5+ seconds until you are returned to the springboard.
 
*Open the iPod app and your new music should now appear
 
*Open the iPod app and your new music should now appear
 
=== Notes ===
 
You can unmount the iphone with:
 
<pre><nowiki>
 
fusermount -u /media/ipod
 
</nowiki></pre>
 
 
Wifi sync is something you couldn't do with iTunes and a Mac/Windows.  It's an extra linux-only feature ;-)
 
 
Album art is supposedly supported with the newest libgpod, but does not work (tested on iPhone)
 
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月30日 (五) 21:03的版本

Setup iPod Touch or iPhone

Disclaimer: Making unsupported changes to your iPhone / iPod Touch could result in data loss and possibly void your warranty. Follow this howto with care.

Determine your Firmware Version

Follow this wiki page for information on how to properly jailbreak.

It has directions for both 1.1.1 and 1.1.2 firmwares. Note that if you want to keep firmware 1.1.2, you may need a Mac or Windows machine to assist you.

OpenSSH

Once you've jailbroken your phone you'll need to install OpenSSH.

  • Navigate to the Installer.app icon that is now on your springboard home screen.
  • Scroll down and click on System
  • Click on OpenSSH
  • Click on Install

BSD Utils

Also, after you've jailbroken your phone you'll need the BSD utility set.

  • Navigate to the Installer.app icon on your springboard home screen.
  • Scroll down and click on System
  • Click on BSD Subsystem
  • Click on Install

Set up Ubuntu

Passwordless Login

When you mount your device (by running sshfs), you're required to supply your password to login. This makes it impossible for applications such as Amarok to perform the mount on demand - as in, connect - since it doesn't take the password prompt into consideration. You need a passwordless login for that! First, you want to generate a private and a public passkey, if you don't have one already. Enter this command on your local machine (not in an ssh session to your device), accept the default location, and don't enter any passphrase.

ssh-keygen -t rsa

This will create a directory called .ssh in your home directory, and place three files in there: id_rsa, id_rsa.pub, and known_hosts. id_rsa is your private keyfile, and id_rsa.pub is your public one. You want your device to have the public key so you can authenticate towards it with your private one. After entering this next command, if it asks if you want to accept the untrusted device as a trusted host, do so.

ssh-copy-id -i ~/.ssh/id_rsa.pub root@<device ip>

This will copy your public keyfile and place it into /var/root/.ssh/authenticated_keys on your device, creating it if necessary. Now log back in.

ssh root@<device ip>

Don't worry if it asks for your password; at this point, it still should. Feel free to view the contents in the authenticated_keys file and compare to your own id_rsa.pub file, if you wish. Don't log out yet.

chmod 0755 ~ ~/.ssh
chmod 0644 ~/.ssh/*

Do this while still logged in. This will set up the permissions the ssh daemon requires to read root's authenticated keys. Next we'll configure some settings.

nano /etc/sshd_config

If you aren't familiar with nano, now's a good opportunity to get to know it better. Scroll down to the segment beginning with '#RSAAuthentication', and set it up as follows:

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile	%h/.ssh/authorized_keys

Be sure to remove any hashmarks (#) at the beginning of those three lines, or else they won't be read. Hit Ctrl+O to save, and Ctrl+X to exit. At this point you should be finished. Reboot your device.

reboot

If you're confident you've given it time enough to start up, try logging back in. Hopefully, without supplying any password.

ssh root@<device ip>

If it still doesn't work:

  • 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?
  • And you did reboot it, right?
  • Check those permissions we changed on certain directories on the device. 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

ipod-convenience (Automatic Method)

For Gutsy users, an application is stored on a PPA (personal package archive) that can be used for properly mounting and unmounting an iPhone or iPod touch so that artwork will work.

deb http://ppa.launchpad.net/ipod-touch/ubuntu gutsy main

Add that repository to your /etc/apt/sources.list. Update your apt database

sudo apt-get update && sudo apt-get upgrade

Install ipod-convenience

sudo apt-get install ipod-convenience

To mount your device use this command:

iphone-mount

To unmount your device, use this command:

iphone-umount

Manual Method

Note: this method is a bit more convoluted, time consuming and prone to errors.

SSHFS

This is what lets you mount ssh filesystems, we'll use this to mount our iphone. Install sshfs:

sudo apt-get install sshfs

Create a mountpoint:

sudo mkdir /media/ipod

Change read/write access to it:

sudo chown <username> /media/ipod

Add your user to the "fuse" user group:

sudo adduser <username> fuse

Log out and back in again (this is necessary for your user group to be taken into account).

Determine your Firewire GUID

The iPod Touch requires you to create a file that is used when generating the iTunesDB and ArtworkDB which store the information of which files are on the iPod. This is not necessary for the iPhone.

Find Firewire GUID

Plug in your iPod Touch or iPhone and run this command:

sudo lsusb -v | grep -i Serial

You will receive an output similar to this:

iSerial                 3 8089e2ce5193625c38813ec10fad4032ec839c02
iSerial                 1 0000:00:1d.7
iSerial                 1 0000:00:1d.2
iSerial                 1 0000:00:1d.1
iSerial                 1 0000:00:1d.0

Now what you are interested in is the first 16 characters of that really long string. This is the Firewire GUID.

Place Firewire GUID in iPhone or iPod Touch

Go to the wifi settings on your iphone. tap the blue arrow next to your SSID, so that you can see your iphone's IP address. Note it down somewhere. SSH into your device. The first time you do this it may take up to 30 seconds to generate the SSH keys. When prompted, the default password is dottie in pre firmware version 1.1.1 and alpine in 1.1.1. With firmware 1.1.2, you will generally have set your root address already.

ssh root@<your device's ip address>

Create the directory structure if necessary

mkdir -p /var/root/Media/iTunes_Control/Device

Create the file for the GUID. Be sure to replace the 16 character string you found with the one after the 0x in this example.

echo "FirewireGuid: 0x8089e2ce5193625c" > /var/root/Media/iTunes_Control/Device/SysInfo

Symbolic Linking

  • Go to your general settings and set "auto-lock" to "never". The iphone closes the wifi connection when it's locked.
  • SSH back into the iPod.
  • If you didn't change your password on your iphone it is highly recommended that you do it now with the passwd command.

Move to where the iTunes library is:

cd /var/root/Media

Make a symbolic link to this directory from within itself (weird, but necesserary):

ln -s . iTunes

Make another symbolic link to the iTunes_Control directory called iPod_Control:

ln -s iTunes_Control iPod_Control

Get out of the iphone.

exit

Mount iPhone

In ubuntu now, we need to actually perform the mount!

sshfs root@<iphone's ip address>:/var/root/Media/ /media/ipod/

Amarok

Amarok seems to manage the iPod touch and iPhone much nicer than gtkpod, but this is a matter of preference. The version of gtkpod in the archives does not properly handle newer devices. There is a version on this PPA (personal package archive) that does.

deb http://ppa.launchpad.net/ipod-touch/ubuntu gutsy main

Add that repository to your /etc/apt/sources.list. Update your apt database

sudo apt-get update && sudo apt-get upgrade

If you don't have gtkpod, install it now:

sudo apt-get install amarok ipodslave

When you first open up Amarok, Click Settings->Configure Amarok. Choose Media Devices. Hit Add Device. Point it at your mount point, /media/ipod. You should now be able to Connect & Transfer with no problems. Be *sure* to disconnect when done so that the database is properly written out.

Automatic Mounting

If you have configured your iPhone or iPod Touch for passwordless login via ssh, you can do this. Otherwise do that first. For the Pre-Connect Command in the settings, add this:

sshfs root@ipod:/var/root/Media /media/ipod -o uid=1000

For the Post-Disconnect Command, add this:

fusermount /media/ipod -u

gtkpod

The version of gtkpod in the archives does not properly handle newer devices. There is a version on this PPA (personal package archive) that does.

deb http://ppa.launchpad.net/ipod-touch/ubuntu gutsy main

Add that repository to your /etc/apt/sources.list. Update your apt database

sudo apt-get update && sudo apt-get upgrade

If you don't have gtkpod, install it now:

sudo apt-get install gtkpod

When you first open gtkpod you may receive some errors. Simply click OK to proceed. Your iPhone or iPod Touch should now appear in gtkpod. If it doesn't, you can manually add it's mount point in the options dialog. Simply add music to the iPhone or iPod Touch like you would any other iPod and Save Changes when done. If you aren't using ipod-convenience, you'll need to kill the iPod app for the track changes to take affect. To do this:

  • Tap the iPod app then hold down the home key for 5+ seconds until you are returned to the springboard.
  • Open the iPod app and your new music should now appear