Share Folder in Ubuntu 11.04 for Mac OSX Lion
September 14, 2011 88 Comments
I just bought a MacMini with OSX Lion 10.7. I chose 2.3GHz Mac mini and added 8 GB RAM on it. I also bought the wireless keyboard and magic mouse. Everything works great with pretty easy setup. Then connect it to the network via wifi.
Many people have problems with the Time Machine setup and connect to shared folder in other server. Some others gave up and down graded back to OSX 10.6 Leopard. I would also do the same is to connect a shared folder in my Ubuntu 11.04. Like many others I found this is not an easy way for me. I have tried Samba with no luck. Samba is no longer supported in OSX Lion. So I choose using Netatalk with little adjustment in OSX Lion to force it able to see legacy AFP.
I read there are ways to solve this problem. One that work for me is using Netatalk and AFP file sharing. There are many guidance you can use. I follow instruction available in the Apple support site, OS X Lion: Connecting to legacy AFP services. For additional reference I also read How to set up AFP filesharing on Ubuntu.
Please note that the shared folder setup in Ubuntu must be in ext4 format. Other format will not work due to only provide readonly to the drive when mounted. I also noted that I can only use IP address when connect to server, use server name doesn’t work.
I’m still struggling to enable the Time Machine feature. For time being the Mac is able to see the TimeMachine drive setup in Ubuntu but when I run the backup it (still) says that the network backup disk does not support the required AFP features. Somebody suggest to use newest beta version of netatalk. I need to try it. I will add here when I found the solution.
I found the right solution. Below is how I accomplished it.
I have tried standard installation, but I found many problems to access it from Mac OSX Lion. I have not tried beta version as suggested in some articles, but I found Netatalk version 2.2.1 answers my problem. This version support NTFS format, so you don’t have to use ext4 format as in previous version. I have tested shared folders in NTFS and Ext4 format drive.
First let’s go to your Ubuntu 11.04. I use 32-bit version of Ubuntu 11.04, but I think should also works on other version. If you already setup Netatalk like me, you need to remove it.
$ sudo apt-get remove netatalk
Download Netatalk 2.2.1 here. Then extract and build it in Ubuntu.
$ tar xzf netatalk-2.2.1.tar.gz
$ cd netatalk-2.2.1
$ sudo apt-get build-dep netatalk
We use default prefix /usr/local, in case you want to use Ubuntu package in the future then it won’t conflict with this version.
$ ./configure --enable-debian
Build and Install Netatalk
$ sudo make install
Install the Avahi Daemon
$ sudo apt-get install avahi-daemon
$ sudo nano /usr/local/etc/netatalk/afpd.conf
Add the below code at the end of file line.
- -tcp -noddp -uamlist uams_randnum.so,uams_dhx.so,uams_dhx2.so -nosavepassword
Setup a folder for Time Machine.
chown macuser /backup/timemachine
You may change the folder name
/backup/timemachine to your folder name, and
macuser to your
username that you already setup in Ubuntu.
Then setup the shared folder for Mac. Open AppleVolumes.default file using your favorite editor (I use nano):
$ sudo nano /usr/local/etc/netatalk/AppleVolumes.default
Add the following code to the end of the file:
/backup/timemachine TimeMachine allow:macuser cnidscheme:dbd options:usedots,upriv,tm
Please note the
tm options. This is a mandatory for Time Machine, otherwise Time Machine will give you error that the AFP version is not supported.
I setup another shared folder so I can use it to store files that I will use in Ubuntu or Windows. First prepare a folder for sharing, give the ownership to
macuser, then add it to the AppleVolumes.Default file. I created a folder called Files, add the line below to the end of the file:
/backup/files Files allow:macuser cnidscheme:dbd options:usedots,upriv
Note that I did not put
tm option for shared folder.
$ sudo nano /etc/avahi/services/afpd.service
Add the following code to the file:
<?xml version="1.0" standalone='no'?><!--*-nxml-*--> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h</name> <service> <type>_afpovertcp._tcp</type> <port>548</port> </service> <service> <type>_device-info._tcp</type> <port>0</port> <txt-record>model=MacPro</txt-record> </service> </service-group>
Start the Netatalk and Avahi services:
$ sudo service netatalk start
$ sudo service avahi-daemon start
Setup Mac OSX Lion
Now the Time Machine and shared folders are ready to use. Let’s go to the Mac part. We have to enable AFP legacy support. Open terminal and run the code below:
$ defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Open Finder, then from the top bar menu click Go then select Connect to Server or press command-K. Enter the Ubuntu address in the Server Address with the following format:
macuser to your
username that you setup in Ubuntu, and change the IP address to your Ubuntu IP. If everything ok, you will see the folders under Shared on the left bar.
Now the last part is testing it to make sure everything works as planned. Open the Time Machine Preference in System Preference, click Select Disk, the timemachine drive should be in the list, select it, then click Use Backup Disk button. You will be asked for password, enter the password, click Connect button. Then turn On the Time Machine. Wait until the Time Machine start the backup, or click the Time Machine icon in the top bar, then click Backup Now.
As you see in the picture above, it took almost an hour for my first backup of about 1.7 GB. Not too bad. I use cable network instead of Wifi.
Now let’s test the shared folder setup. Open Finder from your Mac. You should see your server under the Shared on the left bar menu. Click the server and you will see your shared folder that you setup. Copy any file from your Document folder to the shared folder. If you see no error message, then congratulation you have done it!
This article is written based on various sources. All credits go to these articles: