Read/write a hard drive attached to an Airport Extreme Base Station from Linux (Ubuntu)

UPDATE 28 May 2013: I've updated the instructions below to work on the latest version of Ubuntu, 13.04 (Raring)

I have an Apple Airport Extreme Base Station with an external hard drive attached to it via the USB port (Air disk). This is how to auto mount it in Ubuntu via cifs.

My linux box is running Ubuntu 8.04 (Hardy) and is connected to the Airport Extreme via ethernet. My wife's linux box is also running Hardy and is connected via wifi. Here's how I set it up.

First, we need to configure the Airport base station. Open Airport Utility and click on the Disks tab. Set up read/write support through accounts and setup an account. For this tutorial, I'll say the username was set to 'linux' and the password was set to 'password'.

After setting up the shared disk and accounts, save the configuration (this will reset the router).

In Ubuntu, open a terminal and install the required file like this (the '$' is the prompt):

$ sudo aptitude install cifs cifs-utils winbind

Now you need to edit /etc/nsswitch.conf:

$ sudo vi /etc/nsswitch.conf

Add 'wins' after hosts: files. In my /etc/nsswitch.conf, it looks like this (line 11):

hosts: files wins mdns4_minimal [NOTFOUND=return] dns mdns4

Create a directory where you want to mount the Air disk. I'm mounting mine in /media/video:

$ sudo mkdir /media/video

Now we need to create a credentials file that will be used in fstab:

$ sudo vi /root/.smbcredentials

In this file, we need to put the username and password that has access to the disk. In this example, I was using linux and password, remember? So in this case, .smbcredentials will contain this:

username=linux

password=password

After saving the file, change the permissions!

$ sudo chmod 600 /root/.smbcredentials

Now it's time to add the Air disk to our fstab file:

$ sudo vi /etc/fstab

Add an entry at the bottom like this:

//AirPort/Videos /media/video cifs credentials=/root/.smbcredentials,iocharset=utf8,rw,uid=UID,file_mode=0666,dir_mode=0777 0 0

'Airport' is the name of the base station. 'Videos' is the name of the disk that's plugged into the base station. /media/video is the name of the directory we created to mount the disk under. 'rw' mounts the disk as read/write. If you created a read-only account, this can be replaced with 'ro'. 'UID' should be replaced with your username in linux (or the uid number if you prefer). Now just save the file! Enter this command to make sure it works:

$ sudo mount -a

Assuming no errors, you can now browse your Air disk and read/write to it!

Meta

Published: June 26, 2008

Author: jmhobbs

Word Count: 456

Tags

linux mac ubuntu

  • Tag Cloud

  •  

    Copyright © 2015 Jared Hobbs. All rights reserved. Powered by Pelican. The Hobbs Family theme available here.