Mac file server on CentOS 5
2011.05.09 - posted in CentOSCompletely off topic for this site, but for my own future reference: how to build a Mac file server on a CentOS 5 machine
First you need to enable the EPEL repo as per instructions here: http://fedoraproject.org/wiki/EPEL
Then, we need to install atalk and avahi:
yum install netatalk avahi
Open the file /etc/atalk/AppleVolumes.default and add the following lines (replace USERNAME with the linux username(s) you wish to grant access to):
~/ "$u" allow:USERNAME cnidscheme:cdb
/home/USERNAME/TimeMachine TimeMachine allow:USERNAME cnidscheme:cdb options:usedots
The TimeMachine share will be visible once you login with the linux username and password. You can configure the share in Time Machine with a small change on the Apple machine. Open the file /etc/atalk/afpd.conf and add the following line:
g- -transall -uamlist uams_randnum.so,uams_dhx.so,uams_dhx2.so -nosavepassword -advertise_ssh
Create /etc/avahi/services/afpd.service and paste the data below in this 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=Xserve</txt-record>
</service>
</service-group>
Finally, restart the services:
service avahi-daemon restart
service atalk restart
The new server should pop up in the finder window on your Mac. To be able to configure network shares in Time Machine, you need to run this command (not as root), it is a single line:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Edit on 2011-10-08
If you are unable to (re)start avahi-deamon AND you see this line in /var/log/messages:
dbus_bus_request_name(): Connection ":1.4" is not allowed to own the service "org.freedesktop.Avahi" due to security policies in the configuration file
Then you need to issue: service messagebus restart
Edit on 2011-10-14
Upgrading to Mac OS X Lion breaks this functionality if you don’t use a modified netatalk configuration. The error message shown in Lion’s Finder is:
"The version of the server you are trying to connect to is not supported. Please contact your system administrator to resolve the problem."
The problem is that the original netatalk EPEL rpm misses the configuration for DHX2. I was running Centos 5.7 i386 and obtained an updated rpm here: Fedora Build Netatalk RPM