Saturday, November 19, 2011

Ubuntu as a wireless speaker of iPhone using Airport (ShAirPort)

What I wanted to do at first was to use my PC speaker as a wireless speaker to play music from iPhone directly without any wiring.

My first idea was to use bluetooth.
I had a hard time to set this up and finally succeeded to make an audio sink from iPhone using bluez(
I could listen music with desktop speaker via bluetooth, but it was not so easy to make it running every time I want.

So I bought a bluetooth receiver.

This was very compatible and easy to use.
It automatically turned on only when it pairs with my iphone.
But I have not been using this because I was disappointed its sound quality.

Finally, I could do this with Apple's Airplay (
ShAirPort ( can make Ubuntu to emulate airplay speaker.
It seems to me that ShAirPort was implemented to use Apple's private key(, so please use this at your own risk.
Also note that this instruction is from in ShAirPort source.

1. download source of ShAirPort
Just click 'ZIP' icon, then you can download all source files in one zip archive.

I confirmed new version of shairport does not work with my fresh ubuntu 12.04.
I am not sure what has been changed, but old version of shairport still works on my fresh ubuntu 12.04.
If you don't mind, you may download old version of shairport below.
You may compile and run it as described below.

2. unzip

Open terminal, go to the directory where you stored the source file and unzip.

$ cd Downloads
$ unzip
$ cd albertz-shairport-83c1b71

3. Install followings

$ sudo apt-get install build-essential libssl-dev libcrypt-openssl-rsa-perl libao-dev libio-socket-inet6-perl libwww-perl avahi-utils pkg-config

4. Compile

$ make

Make sure that you have no error.

5. Run

$ ./

That's it.
Now see your iPhone and make sure that you have ios version 5 or later.
You may play it with iPad, iPod and iTunes also.

You should see a new icon when you play a music,
just select new speaker in that menu.

Pros :
- All you need is just local network between iPhone and Ubuntu
- No quality loss
- Easy to configure
- Only few resource consumption

Cons :
- Consumes wireless bandwidth (802.11n is recommended)

uploading file to tftp server on ubuntu 10.04

It was strange for me that I had no problem on using tftp server earlier than Ubuntu 10.04.
I just could upload and download whatever I want only if I get enough permission.
However, it did not work as I expected on Ubuntu 10.04.
I got 'Permission Denied', 'File Not Found' or 'Forbidden directory' error with tftpd + xinetd, tftpd + openbsd-inetd or tftpd-hda.

I had to know that uploading file to a tftp server is not allowed for security reason.

The use of tftp(1) does not require an account or password on the remote system.  Due to the lack of authentication information, tftpd will allow only publicly readable files to be accessed.  Files containing the string ``/../'' or starting with ``../'' are not allowed.  Files may be written only if they already exist and are publicly writable.

So if you want to upload any file to tftp server without any limitation, use following configuration with tftpd-hda.

# /etc/default/tftpd-hpa

TFTP_OPTIONS="--secure --create"

 '--create' option will let you upload anything without limitation, but you should pay enough attention for the security.