You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
3.7 KiB

10 years ago
---
layout: post
status: publish
published: true
title: afpd on Debian
author:
display_name: sipp11
login: sipp11
email: sipp11@gmail.com
url: ''
author_login: sipp11
author_email: sipp11@gmail.com
wordpress_id: 861
wordpress_url: http://blog.10ninox.com/?p=861
date: '2012-01-25 05:43:16 +0700'
date_gmt: '2012-01-24 22:43:16 +0700'
categories:
- linux
- software
tags: []
---
<p>When you are on #OSX regularly, CIFS/SMB is not that good option. What you would need to do so is installing afpd and bonjour. Obviously, they won’t name as they are in Apple product. Their package names are <em>netatalk</em> and <em>avahi</em>consecutively. Installation is as easy as one regular apt-get.</p>
<p>Setting up both at the same time, then we would configure later.</p>
<p><code># apt-get install netatalk avahi-daemon libnss-mdns</code></p>
<p>After installation, we need to configure a bit for both service.</p>
<p><strong>afpd</strong> — what we are going to do now is to disable legacy Apple File protocol back in pre #OSX time which we don’t need.<br />
<code># vim /etc/default/netatalk</code></p>
<pre><code></code> <code><em># enable new service</em></code>
<code>CNID_METAD_RUN=yes </code>
<code>AFPD_RUN=yes </code>
<code><em># disable legacy service</em> </code>
<code>TIMELORD_RUN=no</code>
<code>A2BOOT_RUN=no</code>
<code>ATALKD_RUN=no</code>
<code>PAPD_RUN=no</code></pre>
<p>All you need to do is making sure if these values are assigned correctly. Next, we have to declare sharepoint. You can append to these new settings to the end of this file.<br />
<code># vim /etc/netatalk/AppleVolumes.default</code></p>
<pre><code>/your/path VolumeName allow:@groupname options:usedots,upriv</code></pre>
<p><em>Example:</em><br />
You can do a share by username.</p>
<pre><code>~/ "$u" allow:myusername options:usedots,upriv</code></pre>
<p>For Time Machine, you can do this; it might be a good idea to limit volume size before Time Machine takes over the whole drive by using volsizelimit:100000 in MB; 100000 = 100GB</p>
<pre><code>/home/username/TimeMachine "TimeMachine" allow:myusername options:usedots volsizelimit:100000</code></pre>
<p>Restart netatalk to see the change<br />
<code># /etc/init.d/netatalk restart</code></p>
<p>For more info: <a title="applevolumes.default(5) - Linux man page" href="http://web.archive.org/web/20120307160513/http://linux.die.net/man/5/applevolumes.default" target="_blank">http://linux.die.net/man/5/applevolumes.default</a></p>
<p><strong>Avahi (Bonjour)</strong><br />
Next, we need to do help setting up bonjour or avahi. A setting file is<code>/etc/nsswitch.conf</code> which is belong to mDNS (mDNS comes helping hostname resolution.) we need to enable mdns module by add “mdns” to hosts: line as following:</p>
<pre><code>hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns</code></pre>
<p>Last but not least, we customize how any device see afpd. Create a new file named<code>/etc/avahi/services/afpd.service</code> and paste this in.</p>
<pre>&lt;?xml version="1.0" standalone='no'?&gt;&lt;!--*-nxml-*--&gt;
&lt;!DOCTYPE service-group SYSTEM "avahi-service.dtd"&gt;
&lt;service-group&gt;
&lt;name replace-wildcards="yes"&gt;%h&lt;/name&gt;
&lt;service&gt;
&lt;type&gt;_afpovertcp._tcp&lt;/type&gt;
&lt;port&gt;548&lt;/port&gt;
&lt;/service&gt;
&lt;service&gt;
&lt;type&gt;_device-info._tcp&lt;/type&gt;
&lt;port&gt;0&lt;/port&gt;
&lt;txt-record&gt;model=MacPro&lt;/txt-record&gt;
&lt;/service&gt;
&lt;/service-group&gt;</pre>
<p>You can change model to something else which change icon you will see on #OSX client side. <code>AppleTV, iMac, MacPro, Xserve, MacBook, MacBookPro, MacBookAir, Macmini</code>, etc.</p>
<p>Restart avahi-daemon to see the change</p>
<p><code># /etc/init.d/avahi-daemon restart</code></p>