This is the first how-to article that holds your hand step by step to stream music from the iPhone in Ubuntu over Wi-Fi. This will work on other distributions, simply replace apt-get with your package manager of choice.
Requirements:
– 1.02 Firmware iPhone with OpenSSH installed via Installer.app
– Ubuntu, or probably any distribution based on apt-get (such as Debian)
– Wireless Router (ad-hoc connection probably works too, untested)
These instructions were performed on brand new Ubuntu 32-bit installation of Gutsy Gibbon (7.10). They have been found to be complete and accurate. Installing OpenSSH on the iPhone is outlined in other articles available online, simply search for “iPhone jailbreak” and follow instructions, you will need a Windows PC or Mac.
Using two programs called FUSE (Filesystem in Userspace) and sshfs
we can mount the iPhone filesystem in Linux, then configure ssh key pairs so we can connect without needing to sudo or login as root every time we want to sync the phone, then we’ll install beta versions of Libgpod and Rythmbox to end up with something insanely great:
1. Installing FUSE and other needed programs.
On your PC, goto Applications, Accessories, Terminal
Search for gstreamer in add/remove programs and add everything with the name starting with gstreamer, including ubuntu restricted extras.
Note: You can copy-paste every command from this article using CTRL+Shift+V.
sudo apt-get install sshfs
Then, add yourself to the fuse group with this command:
sudo adduser wayne fuse
[Replace wayne with your username]
Re-authenticate using su - wayne
to avoid /dev/fuse errors later on (or reboot). We’ll be leaving this terminal open for the rest of this guide.
2. Setting up Hosts file, Configuring OpenSSH password, and Configuring SSH Key Pairs
This lets you connect to your iPhone without using a password every time.
Turn off auto-lock on your iPhone by going to Settings | General | Auto-Lock | Never
Adding the iPhone to /etc/hosts
Open a terminal, type:
sudo gedit /etc/hosts
Edit the file to look like this, changing 10.0.0.196 to the IP address of your iPhone:
You can find the IP address of your iPhone by either by looking in your wireless router configuration page (now would be an excellent time to make it a static DHCP address) or on the phone by going to Settings | Wi-Fi, then tapping the blue arrow next to the access point.
Save and quit gedit, you’ll be back to the terminal.
In the terminal we’ll generate SSH keys and connect to the iPhone
ssh-keygen -t rsa
Should output something like this:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/wayne/.ssh/id_rsa): [ENTER]
Enter passphrase (empty for no passphrase): [ENTER]
Enter same passphrase again: [ENTER]
Your identification has been saved in /home/wayne/.ssh/id_rsa.
Your public key has been saved in /home/wayne/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx wayne@gutsy
wayne@gutsy:~/Desktop$
4. Logging into the iPhone via SSH, Resetting Passwords, and setting up the iPhone SSH Keys.
ssh root@iphone
Don’t worry, if it takes a long time – the first time you connect, it takes about 30 seconds to generate keys on the iPhone.
wayne@gutsy:~/Desktop$ ssh root@iphone
The authenticity of host 'iphone (10.0.0.196)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'iphone,10.0.0.196' (RSA) to the list of known hosts.
root@iphone's password: dottie
[This is the default password]
#
At the # prompt type the following:
passwd root
[Type in the new password twice.]
passwd mobile
[Type in the new password twice.]
Configure SSH keys on the iPhone.
mkdir ~/.ssh <<
[Error that it exists is OK.]
chmod go-w / ~
cp /etc/ssh_config /etc/ssh_config.bak
echo AuthorizedKeysFile .ssh/authorized_keys >> /etc/sshd_config
exit
You should see the following output:
Connection to iphone closed.
wayne@gutsy:~$
5. Configure SSH keys on your Linux PC/
scp ~/.ssh/id_rsa.pub root@iphone:.ssh/authorized_keys
You should see something like this:
root@iphone's password:
[type the new password you setup here]
id_rsa.pub 100% 393 0.4KB/s 00:00
wayne@gutsy:~$
6. Mount your iPhone using sshfs
sudo mkdir /media/iphone/ -m 777
When running sshfs you may receive errors. Common ones are about /dev/fuse – logout, reauthenticate using
su - wayne
, or rebooting is a simple solution (although not needed).
sshfs root@iphone:/var/root/Media /media/iphone/
ln -s /media/iphone/iTunes_Control /media/iphone/iPod_Control
7. Install SVN versions of Rhythmbox and Libgpod
Download the debs here. (Thanks funk for packaging these!)
Extract this file with Archive Manager, then double click on each one and install each package.
After installing all of these, when you open up Rhythmbox via Applications | Sound & Video | Rythmbox
, your iPhone will magically appear in the devices list, and allow you to stream media via wireless. If it’s not working, make sure that you can still browse to /media/iphone
and view files yourself.
To ummount the iPhone:
fusermount -u /media/iphone
To re-mount the iPhone:
sshfs root@iPhone:/var/root/Media /media/iphone/
Did you run into any problems? Comment here and I’ll help you out best I can.
Bonus tip: Mount /var/root/Library/Ringtones
instead and load up on ringtones!
36 replies on “How To: Stream Music From The iPhone In Ubuntu”
Resources and Thanks: Extrapepperoni: SSH on iPhone, HOWTO: Setup ssh keys, funk’s corner of the interschnitzel: Ubuntu & The iPod Nano, and finally Eric Betts.
[…] You can read the rest of this blog post by going to the original source, here […]
Now I just wish you could stream content the other direction, ie: to the iphone.
How To Stream Music From iPhone In Ubuntu…
Do you still feel that if you use Ubuntu as your primary operating system you won’t be able to use the cool gadgets and software that you are so accustomed to using? Well you need a rethink. This step by step tutorial teaches you how to stream mu…
I stream music and videos from my server over TCP/IP to my Windows phone using Orb or VLC. EVDO usually gets between 800 Kbps and 1.5 Mbps over the Verizon/Sprint public network.
Tyce–check this out:
http://pixelcity.com/iphone-streaming-music/
It was written to share an iTunes library in OS X (with the folder structure Artists->Albums->Songs) but it could easily be modified to work with any folder structure. It’s just a few dozen lines of PHP. It’s just a plain web thing so if you’ve got your server open to the outside world, you can listed to your music from anywhere. Even works over EDGE, if you’re lucky. 🙂
regarding step 5.. ever heard of ssh-copy-id? The step would then look like this:
ssh-copy-id root@iphone
This command handles the creation of directories and the authorized_hosts file automatically.
[…] read more | digg story […]
I have some problems with point 6. I have an iphone fw 1.1.1
I can mount my iphone by sshfs but the next step does not work
when i use sshfs root@iphone:/var/root/Media /media/iphone/
then i get a message :”fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the ‘nonempty’ mount option”
at the next point ln -s /media/iphone/iTunes_Control /media/iphone/iPod_Control
i get the message ” Too many levels of symbolic links”
I just updated to 1.1.1 myself, I’ll see if I can update the process… I’ll also be checking if syncing with libgpod works yet.
Hello
Ubuntu 7.10 iphone 1.1.1
root@iphone’s password: dottie [This is the default password]
iPhone 1.1.1 password: alpine
—————————————————-
mount my iphone: Yes
Rhythmbox: it closes application automaticamente
Saludos!!!
After performing these steps my SSH stream is working great, but my ipod is not registering any data.
im having the same problem as Ben. i can upload songs onto the ipod touch but they dont show on it. any help?
[…] has. I read about a Google Code project that would let you do it from MacOSX, and then I found this, which says it’ll work from Rhythmbox. Despite having absolutely fantastic taste in blog […]
I have the same problem as hokus it says :”fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the ‘nonempty’ mount option”
at the next point ln -s /media/iphone/iTunes_Control /media/iphone/iPod_Control
i get the message ” Too many levels of symbolic links”
so can anyone please help me out 🙂 thank u guys so much
You have to go to media/iphone in your file manager and there will be some short cuts to files that don’t exist, just select them and shift+delete them. then try remounting.
As for copying music on your iphone/ipod touch you have to use Amarok or gtkpod.
For the ipod-touch after you mount it you have to issue the commands
“cd /media/iphone/iPod_Control/Device”
then
“sudo lsusb -v -d 05ac: | grep iSerial | awk ‘{print $3}’ | cut -b1-16 | xargs printf “FirewireGuid: 0x%sn” > SysInfo”
(without the first and last quotes)
then in amarok set it up as an iphone and enjoy wifi transfers!
Man this is the owsomest post about how to sync the iphone with some media player.
Thank you very much
edy
The only problem till now is when i wanna listen to some music y have on my iphone directly on my computer, it does play the songs, after some minutes it give you back a red circle with a white X next to the song thats in your iphone, but the rest worck perfectly, i can even put some music from PC to te iphone using ubuntu, so thanks for the information
great! thanks for sharing
[…] you’re going to prove to your Apple device that you’re trustworthy. Pulling from the fsckin w/linux blog’s guide, here’s the basic terminal steps, with the parts you’ll substitute in bold. They look […]
I have ubuntu 64 and the step 7 (Install SVN versions of Rhythmbox and Libgpod ) doesn’t work, where can i find the svn to 64 bits?
comments & corrections –
-after i deleted the bogus mountpoint and remade it (I had to sudo create it and then chown it) mounting with sshfs worked, I could see the ipod in rhythmbox.
-when I add music I have to reboot the iphone for it to show up in the ipod app, does anyone have a fix for this?
-you say to use the passwd command to change passwords, this is lethal! all applications on the iphone quit after a few seconds and the iphone is unusable. took me hours to fix it. can you remove this from the main post…
[…] you’re going to prove to your Apple device that you’re trustworthy. Pulling from the fsckin w/linux blog’s guide, here’s the basic terminal steps, with the parts you’ll substitute in bold. They look […]
[…] read more | digg story […]
Good day!,
Hi!,
good article keep it up 🙂
good post
Hello, I can’t “see” anything inside the iphone’s Music folder in the Media directory either from Terminal in the phone, not from my Linux laptop in ssh. I thought this post might help me out, so I started following along.
When I get to Configure SSH keys on the iPhone, I run into a problem. There is no ssh_config file in the etc/ directory. Has this changed in the later versions of the phone’s OS? Any advice?
Most obliged. All the best, leigh
Ah, ok, it’s in it’s own ssh sub-directory. What about an:
/id_rsa.pub: No such file or directory
error when configuring ssh keys on the Linux PC? Does anyone know what that is about?
Best, Leigh
Towards the end of step 4, I think the correct file to modify is /etc/ssh_config instead of /etc/sshd_config:
echo AuthorizedKeysFile .ssh/authorized_keys >> /etc/ssh_config
ssh: connect to host iphone port 22: No route to host
is the answer i get from ssh root@iphone. please help. thanx
Crap, I think I did it wrong…
[…] great that we can actually talk to our iTunes Database now, yay! But, we still need to go through a lengthy procedure to setup remote ssh filesystem access because Apple pulled another Microsoft and invented a new USB […]
Hi, I think this is a great tutorial, but I have a problem, I’ve already have rhytmbox installed and is not working. Do i have to install the version that you put here? If is it, why is that? can you please explain me?
Thanks a lot
[…] you’re going to prove to your Apple device that you’re trustworthy. Pulling from the fscki n w/linux blog’s guide, here’s the basic terminal steps, with the parts you’ll substitute in bold. They look […]