How to fun_plug

Creating a fun_plug file on your hard disk allows you to run a custom boot script. This feature allows additional software to run on the DNS-323.

The most popular fun_plug implementation is Fonz fun_plug. For a good set of tutorial see ffp.

How fun_plug works:

When the DNS-323 boots it reads /etc/inittab which will execute the /etc/ script, just as the DSM-G600:


This file will mount your disks and startup daemons running on the unit.

The last thing that happens is the magic we use to get access to the unit. This is what makes the black box a white box.

What happens is that the /etc/ script calls the /usr/sbin/chk_fun_plug script:

/usr/sbin/chk_fun_plug &

The /usr/sbin/chk_fun_plug script itself will check the mounted disk /mnt/HD_a2 for presence of a file called fun_plug and execute it if there.

DNS-323 Boot Process

DNS-323 Boot Process

As this file is located in one of the inserted disks we can place our own file there and get access to the unit, most likely through telnet.

Installing a fun_plug

There are many ways to achieve this, but all of them includes creating the file. The file we use here is a very simple fun_plug which only prints some system startup information into another file:

# Simple fun_plug
dmesg > /mnt/HD_a2/dmesg.out

Next step is to transfer this file and give it proper rights, i.e. the right to execute.

Transfer using FTP

  1. Enable FTP through the admin pages and set up an ftp user.
  2. Create a test fun_plug file on your system.
  3. Connect to your DNS-323 using a command line ftp client (in windows: start / run / ftp)
  4. Change to the root directory: cd /
  5. Upload your fun_plug: put fun_plug
  6. Make it executable: chmod 777 fun_plug
  7. If command prompt doesn't recognize 'chmod', use 'quote site chmod 777 fun_plug'
  8. Quit ftp: quit

NOTE For v1.03+ From the Beginner's FAQ: Q: Where does it go? A: The fun_plug file needs to be in your root directory where you can see it when you access the network drive. When using 1.03 firmware for example that location would be inside the directory called “Volume_1”

Transfer using SMB mounted drives

  1. Create a test fun_plug on your system.
  2. FW 1.01: Create the test fun_plug on \\NAS\HDD_1
  3. FW 1.02: Create the test fun_plug on \\NAS\Volume_1

Version 1.01 and 1.02 have proper umask set so the files should have proper rights. But; better to be safe than sorry and ftp to your unit and make sure the file has at least rwx—— rights.

Windows users should note that the fun_plug file must be in unix file format (LF for newline) and not in Windows (CR LF for newline). One suggested editor for Windows is UltraEdit or Notepad++ which let you save the file in both formats.

Creating one from a serial connection

  1. With a serial connector on your unit, break into shell by issuing 5784468 at the prompt.
  2. Change directory to /mnt/HD_a2
  3. Create the fun_plug using “echo dmesg » /mnt/HD_a2/fun_plug”

Inserting one using an external system

See the instructions for DSM-G600.

File Permissions

An important point in the fun_plug installation. The “fun_plug” file on the device needs to have the executable permissions. Otherwise known as 777 for the chmod command. This will give it read write and execute by all users on the system.

This is achieved by executing the chmod command (given below) from the directory of the fun_plug.

chmod 777 fun_plug

The key is being able to do this. In earlier versions of the D-Link firmware, this could be done through ftp. All one had to do is set-up an account with read write permissions. Then through a command line version of an ftp client one could execute this command.

The D-Link firmware version 1.09 does not allow FTP users to change permissions. However the earlier version 1.06 does. If users are stuck with changing permissions, you should install firmware 1.06. Then proceed to install fun_plug. If the user wants features in the latest firmware they can still upgrade and retain fun_plug functionality provided that the fun_plug script has kept the executable permissions.

What's Next

So; you have a fun_plug working and want to do something with it. Start with telnet and maybe a debian Sarge chroot system. Upgrade your iTunes server or make your ftp server working in a NAT'ed environment.

For a comprehensive list of what you can do with your DNS-323 take a look at the howtos list.

But remember, always have fun, ;-), and be aware that you're now in a position where you can easily brick your unit.

Having issues?

Visit out our Beginner's FAQ for more information about what to do.

A simple step by step description can be found here: Simple fun_plug StepByStep


Personal Tools