• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Noulakaz

Noulakaz

The blog of Avinash, Christina, Anya and Kyan Meetoo.

  • Home
  • About
  • People
    • Christina & Avinash Meetoo
    • Avinash Meetoo
    • Christina Meetoo
    • Anya Meetoo
    • Kyan Meetoo
  • General
    • News
    • Mauritius
    • Politics
    • Education
    • Business
    • Travel
  • Computing
    • Apple
    • Linux
    • LUGM
    • Programming
    • Web
    • Technology
    • Knowledge Seven
  • Entertainment
    • Music
    • Movies
    • Photography
    • Sports

Installing Avahi and AFP on the DNS-323

2 November 2009 By Avinash Meetoo 103 Comments

20091102-macbook-dns-323

The D-Link DNS-323 NAS is great. It runs Linux, is infinitely tweakable and plays nicely with most devices I have at home including my MacBook, my Linux boxes and my Wii running MPlayer CE which I use to watch DivX on my TV.

 

The only problem I had was that the NAS only offered SMB (via Samba) out of the box which meant that some operations were somewhat slow when initiated from my MacBook. For instance, deletes were slow even though transfer speeds were great. After reading some posts online, I realised that the solution was to activate AFP (Apple Filing Protocol) as well as Multicast DNS (Bonjour) on the NAS. AFP is provided by Netatalk and Bonjour by Avahi.

Of course, to install new software on the DNS-323, you must have fun_plug properly activated.

Installing Avahi on the DNS-323

1) Get libdaemon and avahi.

Install both with

funpkg -i libdaemon-0.13-1.tgz
funpkg -i avahi-0.6.24-1.tgz

2) Add an avahi user

groupadd -g 50 avahi
useradd -u 50 -g avahi -d /tmp -s /bin/false avahi

3) Create a startup script called /ffp/start/avahi.sh as shown here.

#!/ffp/bin/sh

# PROVIDE: avahi
# REQUIRE: SERVERS

. /ffp/etc/ffp.subr

name="avahi"
command="/ffp/sbin/avahi-daemon"
avahi_daemon_flags="-D -s"
required_files="/ffp/etc/avahi/avahi-daemon.conf /ffp/etc/avahi/hosts"

start_cmd="avahi_start"

avahi_start()
{
	# need avahi user and group for priviledge separation
	if ! grep '^avahi:' /etc/passwd >/dev/null; then
	        echo 'avahi:x:50:50:Avahi Daemon:/no/where:/bin/false' >>/etc/passwd
	fi
	if ! grep '^avahi:' /etc/shadow >/dev/null; then
	        echo 'avahi:*:14493:0:99999:7:::' >>/etc/shadow
	fi
	if ! grep '^avahi:' /etc/group >/dev/null; then
	        echo 'avahi::50:avahi' >>/etc/group
	fi

	proc_start $command
}

run_rc_command "$1"

4) Make the file executable so that avahi starts when the DNS-323 boots

chmod +x /ffp/start/avahi.sh

5) Create /ffp/etc/avahi/services/smb.service

<?xml version="1.0" standalone="no"?><!--*-nxml-*-->
<service-group>
        <name replace-wildcards="yes">%h</name>
        <service>
                <type>_smb._tcp</type>
                <port>445</port>
        </service>
</service-group>

6) Create /ffp/etc/avahi/services/http.service

<?xml version="1.0" standalone="no"?><!--*-nxml-*-->
<service-group>
        <name replace-wildcards="yes">%h</name>
        <service>
                <type>_http._tcp</type>
                <port>80</port>
        </service>
</service-group>

7) Create /ffp/etc/avahi/services/device-info.service (This changes the ICON shown in Mac OS X)

<?xml version="1.0" standalone="no"?><!--*-nxml-*-->
<service-group>
        <name replace-wildcards="yes">%h</name>
        <service>
                <type>_device-info._tcp</type>
                <port>0</port>
                <txt-record>model=RackMac</txt-record>
        </service>
</service-group>

8 ) Launch avahi

/ffp/start/avahi.sh

Installing AFP (netatalk) on the DNS-323

1) Get db42 and netatalk and install both with

funpkg -i db42-4.2.52-1.tgz
funpkg -i netatalk-2.0.4-1.tgz

2010-10-27: an important update courtesy of David:

It looks like netatalk-2.1.3-1 now requires db48-4.8.30-1 instead of db42-4.2.52-1. I installed db48 and removed db42, and I can connect to the DNS-321 via AFP without any problems, including over a reboot.

2) Create a startup script called /ffp/start/afpd.sh as shown here.

(Important update for Snow Leopard users: It seems that netatalk 2.0.4 does not work properly with Snow Leopard and provokes CNID errors. You should use the latest netatalk 2.1 and follow Ivan’s recommendations to start the cnid_meta daemon automatically for everything to work. Thanks Ivan!

Furthermore, according to Ole, /ffp/etc/netatalk/afpd.conf needs to be modified to have the following line (make sure that you have everything on one line):

"servername" -uamlist uams_dhx.so,uams_clrtxt.so
-setuplog "default log_info /ffp/var/run/afpd.log" -cnidserver

He says: “It is important to have the -cnidserver at the end. Dont know why, but it is.”)

#!/ffp/bin/sh

# PROVIDE: afpd
# BEFORE:
# REQUIRE:

. /ffp/etc/ffp.subr

name="afpd"
start_cmd="afpd_start"
stop_cmd="afpd_stop"
status_cmd="afpd_status"

afpd_start()
{
    /ffp/sbin/afpd
}

afpd_stop()
{
    killall afpd
}

afpd_status()
{
    ps -A | grep /ffp/sbin/afpd | grep -v grep
}

run_rc_command "$1"

3) Make it executable with

chmod +x /ffp/start/afpd.sh

4) Create /ffp/etc/avahi/services/afpd.service as show here.

<?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-group>

5) Use the “vipw” command and change some details for the default “nobody” user so that Mac OS X can use that user to log in.

nobody:x:501:501:Linux User,,,:/home/nobody:/ffp/bin/bash

Give a password to that user and store the password (in clear text) in the user’s home directory as shown here.

passwd nobody
cd /home
mkdir nobody
echo "secret" > nobody/.passwd
chown -R nobody: nobody

It is essential to store this user’s information in the flash memory of the DNS-323. Do this with:

store-passwd.sh

6) Modify /ffp/etc/netatalk/AppleVolumes.default to add the required shares. Mine looks like:

# The "~" below indicates that Home directories are visible by default.
# If you do not wish to have people accessing their Home directories,
# please put a pound sign in front of the tilde or delete it.
# ~     

/mnt/HD_a2 Volume_1
/mnt/HD_b2 Volume_2

Notice that I have commented the ~ because I don’t want the user to have a home directory on the DNS-323. I only want to access Volume_1 and Volume_2.

7) Start netatalk

/ffp/start/afpd.sh start

Making Mac OS X Leopard play nice with Netatalk

To allow Leopard to connect to AFP shares with clear text (unencrypted) passwords, do as shown here:

# to be done on the Mac and not the DNS-323
sudo defaults write com.apple.AppleShareClient "afp_cleartext_allow" -bool YES
sudo defaults write com.apple.AppleShareClient "afp_cleartext_warn" -bool YES

Enjoy!

You can now connect to the DNS-323 from a Mac and get optimal performance. Phew. Linux is sooooo fun… for geeks like me :-)

5 November 2009 update: Instead of creating a new user, the existing user “nobody” is used. This allows the DNS-323 to be used through AFP and SMB transparently as SMB uses “nobody” by default. Interestingly, when the DNS-323 reboots, its /home directory starts anew and therefore will lack a /home/nobody directory (with its .passwd file) but this does not seem to trouble Mac OS X.

Filed Under: Apple, Linux, News, Programming, Technology

Barack Obama wins the Nobel Peace Prize

9 October 2009 By Avinash Meetoo 19 Comments

Obama 2008

I am just discovering that Barack Obama has won the 2009 Nobel Peace Prize “for his extraordinary efforts to strengthen international diplomacy and cooperation between people.”

What can I add?

Barack Obama has really changed the way non-Americans (like me) now perceive Americans following the damage done by George Bush when he started a war without being allowed to do so by the United Nations. Thanks to Obama, we now know that Americans are not egoistic and fanatical but can also show signs of intelligence and understanding.

I like that America now sees things in various shades of grey instead of that utterly stupid “Either you’re with us, or against us” stance they had before.

The world is complex. People are complex. And no one is 100% good and 100% bad. The thing is, we have to live together. And I think Obama understands this.

Filed Under: Education, News, Politics

Mac OS X Leopard printing to Linux CUPS server

9 September 2009 By Avinash Meetoo 4 Comments

20090909-printing-press

I generally use my MacBook (running Mac OS X 10.5 Leopard) at work and it is essential for me to be able to print documents on my network printers attached to a Linux CUPS server (running CentOS Linux 5.3.)

What needs to be done on the Mac OS X Leopard computer

For some reason, Leopard cannot see printers shared by CUPS by default (it only sees Bonjour printers.) To rectify this, open a terminal and type:

sudo vi /etc/cups/cupsd.conf

and add “BrowseProtocols all” so that the file looks like this:

# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseAddress @LOCAL
BrowseProtocols all
DefaultAuthType Basic
<Location />
# Allow shared printing…
Order allow,deny
Allow @LOCAL
</Location>
# Enable printer sharing and shared printers. Browsing On BrowseOrder allow,deny BrowseAllow all BrowseAddress @LOCAL BrowseProtocols all DefaultAuthType Basic &lt;Location /&gt;  # Allow shared printing...  Order allow,deny  Allow @LOCAL &lt;/Location&gt;

Then restart the CUPS daemon running on the Mac with

sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist

What needs to be done on the Linux server

Modify /etc/cups/cupsd.conf so that its beginning somewhat looks like this:

# Share local printers on the local network. Browsing On BrowseOrder allow,deny BrowseAddress @LOCAL DefaultAuthType Basic &lt;Location /&gt;   # Allow shared printing...   Order allow,deny   Allow @LOCAL &lt;/Location&gt;

and restart the CUPS server with one of:

/etc/init.d/cups restart /etc/init.d/cupsd restart

and everything should work from there. Go on your Mac and add your Linux printers in the usual way.

 

One observation I made

Printing generally works great but sometimes stop working when either the Mac or the Linux server are updated. What happens is that, during the update, the CUPS configuration (/etc/cups/cupsd.conf) gets slightly changed to something much more restrictive for security reasons (i.e. network printing is disabled.) I guess this is because both the Apple and Linux people think that it’s better be prudent than sorry especially in our era of fully opened Wifi network.

You’ve been warned :-)

Filed Under: Apple, Linux, Technology

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 112
  • Page 113
  • Page 114
  • Page 115
  • Page 116
  • Interim pages omitted …
  • Page 275
  • Go to Next Page »

Primary Sidebar

Our Personal Websites

Avinash Meetoo
Christina Meetoo
Anya Meetoo
Kyan Meetoo

Archives

  • May 2025 (1)
  • April 2025 (4)
  • January 2025 (3)
  • December 2024 (2)
  • November 2024 (2)
  • October 2024 (3)
  • September 2024 (7)
  • August 2024 (1)
  • July 2024 (1)
  • June 2024 (2)
  • May 2024 (3)
  • January 2024 (2)
  • December 2023 (1)
  • October 2023 (1)
  • September 2023 (4)
  • August 2023 (3)
  • July 2023 (1)
  • June 2023 (4)
  • May 2023 (1)
  • April 2023 (1)
  • March 2023 (5)
  • February 2023 (1)
  • December 2022 (1)
  • November 2022 (1)
  • October 2022 (4)
  • August 2022 (4)
  • July 2022 (3)
  • June 2022 (5)
  • May 2022 (5)
  • January 2022 (3)
  • December 2021 (2)
  • November 2021 (1)
  • October 2021 (1)
  • September 2021 (4)
  • August 2021 (2)
  • July 2021 (14)
  • May 2021 (2)
  • April 2021 (4)
  • March 2021 (9)
  • February 2021 (2)
  • January 2021 (1)
  • October 2020 (1)
  • September 2020 (1)
  • August 2020 (2)
  • July 2020 (5)
  • June 2020 (3)
  • May 2020 (5)
  • April 2020 (6)
  • March 2020 (2)
  • February 2020 (2)
  • January 2020 (2)
  • October 2019 (1)
  • September 2019 (2)
  • July 2019 (2)
  • June 2019 (1)
  • May 2019 (3)
  • April 2019 (2)
  • March 2019 (1)
  • February 2019 (1)
  • January 2019 (3)
  • December 2018 (1)
  • October 2018 (3)
  • August 2018 (2)
  • July 2018 (2)
  • June 2018 (1)
  • May 2018 (2)
  • April 2018 (1)
  • February 2018 (1)
  • December 2017 (1)
  • October 2017 (1)
  • September 2017 (1)
  • August 2017 (1)
  • July 2017 (1)
  • May 2017 (4)
  • April 2017 (3)
  • March 2017 (4)
  • February 2017 (5)
  • January 2017 (3)
  • October 2016 (1)
  • September 2016 (1)
  • August 2016 (4)
  • July 2016 (1)
  • June 2016 (1)
  • March 2016 (3)
  • February 2016 (3)
  • January 2016 (1)
  • December 2015 (1)
  • November 2015 (2)
  • September 2015 (1)
  • August 2015 (3)
  • March 2015 (1)
  • December 2014 (1)
  • November 2014 (4)
  • October 2014 (1)
  • March 2014 (2)
  • February 2014 (3)
  • December 2013 (1)
  • October 2013 (1)
  • September 2013 (1)
  • August 2013 (1)
  • July 2013 (1)
  • June 2013 (2)
  • May 2013 (1)
  • March 2013 (3)
  • January 2013 (2)
  • December 2012 (3)
  • November 2012 (4)
  • September 2012 (3)
  • August 2012 (2)
  • July 2012 (3)
  • June 2012 (2)
  • May 2012 (1)
  • April 2012 (2)
  • February 2012 (1)
  • January 2012 (4)
  • December 2011 (2)
  • November 2011 (1)
  • October 2011 (4)
  • September 2011 (2)
  • August 2011 (1)
  • July 2011 (2)
  • June 2011 (4)
  • April 2011 (7)
  • March 2011 (2)
  • February 2011 (1)
  • January 2011 (3)
  • November 2010 (3)
  • October 2010 (1)
  • September 2010 (2)
  • August 2010 (4)
  • July 2010 (2)
  • June 2010 (1)
  • May 2010 (3)
  • April 2010 (4)
  • March 2010 (3)
  • February 2010 (3)
  • January 2010 (5)
  • December 2009 (2)
  • November 2009 (3)
  • October 2009 (1)
  • September 2009 (5)
  • August 2009 (3)
  • July 2009 (1)
  • June 2009 (3)
  • May 2009 (2)
  • April 2009 (7)
  • March 2009 (12)
  • February 2009 (10)
  • January 2009 (5)
  • December 2008 (4)
  • November 2008 (11)
  • October 2008 (6)
  • September 2008 (7)
  • August 2008 (3)
  • July 2008 (8)
  • June 2008 (6)
  • May 2008 (5)
  • April 2008 (7)
  • March 2008 (6)
  • February 2008 (3)
  • January 2008 (6)
  • December 2007 (11)
  • November 2007 (10)
  • October 2007 (7)
  • September 2007 (9)
  • August 2007 (3)
  • July 2007 (7)
  • June 2007 (8)
  • May 2007 (14)
  • April 2007 (11)
  • March 2007 (18)
  • February 2007 (14)
  • January 2007 (15)
  • December 2006 (16)
  • November 2006 (10)
  • October 2006 (7)
  • September 2006 (8)
  • August 2006 (8)
  • July 2006 (6)
  • June 2006 (4)
  • May 2006 (13)
  • April 2006 (10)
  • March 2006 (11)
  • February 2006 (7)
  • January 2006 (14)
  • December 2005 (8)
  • November 2005 (6)
  • October 2005 (7)
  • September 2005 (2)
  • August 2005 (6)
  • July 2005 (2)
  • June 2005 (6)
  • May 2005 (15)
  • April 2005 (12)
  • March 2005 (3)
  • February 2005 (8)
  • January 2005 (3)
  • December 2004 (1)
  • November 2004 (2)
  • October 2004 (2)
  • September 2004 (3)
  • August 2004 (3)
  • July 2004 (3)
  • June 2004 (3)
  • May 2004 (6)
  • April 2004 (10)
  • March 2004 (12)
Creative Commons License This work is licensed by Avinash Meetoo under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License.