for the D-Link DNS-320 Sharecenter Pulse

The D-Link DNS-320 needs a different than the one supplied with Fonz fun_plug. Basically it is very simple if you look at the contents:

echo "Saving Userdata to /usr/local/config/"
cp -f /etc/passwd /usr/local/config/
cp -f /etc/group /usr/local/config/
cp -f /etc/shadow /usr/local/config/
cp -f /etc/samba/smbpasswd /usr/local/config/

Run the following command to download it to the NAS:

wget -O /ffp/sbin/

Then proceed with the installation of Fonz fun_plug.

Firmwareupgrade Procedure for NAS-Devices with fun_plug

Configuration interface for upgrading firmware
This procedure allows you to upgrade (or downgrade) the version of the firmware running on the NAS. Although backups are always nice (if you have that option), the data stored on the NAS is not affected. Similarly, any servers (daemons) running under fun_plug are also unaffected (although they are temporarily turned off and later turned on again).

Note that this somewhat elaborate procedure is needed if you are running fun_plug. If you do not have fun_plug installed, or it is no running, you can should use the simpler instructions provided by Conceptronic with the firmware file.

Checking the firmware version

You can tell which firmware version you are running by using a web browser:

  • browse to the CH3SNAS using an IP address (default is or a network name (maybe http://CH3SNAS)
  • If this brings you to a web page you created yourself, you are likely running fun_plug and have the lighttpd HTTP server running on port 80 and need to use port 81 to reach the configuration screen (e.g. using If you don’t know what funplug is, you are not using it and you can ignore this comment.
  • login as admin
  • Then go to: ”Configuration” >> ”Tools” >> ”Firmware”

This should get you to the screen shown in the picture.

Downloading firmware versions

An overview of the current stable version, any more recent beta (or “Release Candidate”) versions, or older versions can be found here.
The page contains links to sites where the firmware can be downloaded. After downloading the required version you will need to unzip or unrar it.

Installation if you don’t use funplug

If you are not running fun_plug, you can simplify things by following the instructions in the PDF readme file supplied with the downloaded firmware rather than following the fancier instructions below which assume you may be running various special servers and running with special settings.
So, in the following, we assume that you are running fun_plug.

Temporarily reactivate Telnet

If you are running funplug, it is likely that you enabled ssh (Secure Shell) and disabled telnet for security reasons. After the reboot, all modifications to /etc/passwd and /etc/group are gone, which is why we need to temporarily reactivate telnet to ensure that we can login after the upgrade:

  • run ssh (e.g. using PuTTY)
  • activate the telnet daemon so you can easily login later:
    cd /ffp/start
    ls -al
    chmod a+x
    ls -al

    This means that on the next reboot telnet should be enabled.

Notes on CH3SNAS Firmware 1.05 regarding the fan

If you are upgrading from a pre-1.0.5 firmware version to version 1.0.5 or later, you may decide to replace the special fan control script “fanctl” from Fonz (see the fan control tutorial) with the standard fan control feature built into the Conceptronic firmware.

Which option is better? The firmware version 1.0.5 has a very simple fan control algorithm. The fan only runs when the internal temperature is 43°C or higher. This is a bit high. Furthermore, the fan speed does not depend on the temperature: the fan is either on or off. Fonz’ solution instead increases the fan speed as the temperature rises. This avoids the fan repeatedly turning on and off when the fan needs to spin, but doesn’t need to run at full speed.

If you decide to try the firmware’s solution, you can deactivate Fonz’ control program using:

cd /ffp/start
sh status
ls -al
chmod a-x
ls -al

The 2nd line reports whether the fanctl utility is running. The chmod a-x causes the special fan script to be disabled on the next reboot.

Temporarily disable funplug

Rename the file fun_plug to fun_plug.bak to deactivate ffp on the next boot. You can easily do this using e.g. Windows Explorer or using the command shell:

cd /mnt/HD_a2
ls fun_plug*
mv fun_plug fun_plug.bak
ls fun_plug*

Saving settings

Write down any special configurations you have set up in the system.

The main place to look is in the ”Advanced” tab of the Configuration web page. Write down a reminder to set any particular settings such as ”’users”’ who have access, ”’groups”’ you may have created, ”’ftp access”’ you may have given to groups, etc. If you forget to reconfigure these, you will find out later when e.g. an ftp account doesn’t work. Unfortunately there is no simple way to save these settings and later reload them: you will, for example, have to reenter or define new passwords.

The other setting worth saving is any non-default IP address or network name of your CH3SNAS.

Installing new firmware

Update the firmware via the web interface (see picture above). During the update, you will get a progress bar. Then, after confirmation, the CH3SNAS will reboot.

Next reset the CH3SNAS firmware settings to the factory defaults (the new firmware may interpret settings stored in Flash memory differently that the previous version). This step is mandatory to ensure correct operation!

  • Open the configuration page
  • Goto: Tools >> System >> Restore To Factory Default Settings

This will cause another reboot during which the IP address, group/user information, user privileges will be lost. Your browser may not find the device again if you use a non-default name. Try the default “http://CH3SNAS/” or using Conceptronic’s “Easy Search Utility” to find your NAS in the network.

Basic configuration

At this point, the administrator password is empty, so you can log onto the Config web page as admin with an empty password. Then you need to run Setup >> Run Wizard to get the basic settings correct again. These include

  • the admin password
  • timezone and daylight savings time setting
  • IP address (if set to static)
  • the network workgroup
  • the network name of the CH3SNAS

This will lead to a restart after which you will also be able to see the CH3SNAS under its original name on the network and the stored data should be accessible.


At this point you cannot access the CH3SNAS via either telnet or ssh because an out-of-the-box CH3SNAS does not enable either daemon:

  • rename fun_plug.bak back to fun_plug using SAMBA (e.g. using Windows Exporer)
  • reboot the CH3SNAS (e.g. using the Configuration page: Tools >> System >> Restart).
    Note that before the reboot, your Config page is on port 80. It may be on port 81 after the reboot. From this point on telnet should work again.
  • Login with telnet and set the root password again using this procedure. This ends with running to save the password information.
  • deactivate telnet again (first be sure ssh is running!) using an ssh session on PuTTY:
    cd /ffp/start
    ls -al
    chmod a-x
    ls -al
    sh stop

    The final line stops the telnet daemon, so from this point on you (only) have access via the much more secure ssh.

User settings

You can now redefine any required user- and group settings (e.g. for ftp users).

Note that after updating the firmware, the NAS will spend a few hours reindexing the hard disks (searching for movies and audio-files) for the itunes and UPnP-services. You can stop this activity by deactivating the respective services.

Compiling Software for the Fonz fun_plug

This tutorial is for advanced users only!

Fonz provides many pre-compiled packages for the NAS in his repository, but obviously cannot provide every package which someone out there might need. So to help users compile and link packages themselves, Fonz has created a complete software environment for building packages for the NAS device.

This ffpbuildenv environment consists of a few scripts and a standardized process for building software packages. It runs on the NAS itself, rather than requiring special cross-compilation tools on a PC. This helps guarantee full compatibility with the target system and ensures that the environment is familiar to developers with a Linux background.

The following tutorial builds on Fonz’s work, but also contains procedures and descriptions by Uli. User PeterH did his usual testing and polishing routine on this text.



Setup a fun_plug and install ALL packages available as described in the linked tutorial.


ffpbuildenv can best be installed on one of the hard disks:

mkdir /mnt/HD_a2/ffpbuildenv
cd /mnt/HD_a2/ffpbuildenv
svn co svn:// .

These steps create a new directory on drive /mnt/HD_a2/ and copy the required files from Fonz’ repository using the [ Subversion] version control system.

General Use

Chrooting to the build environment

To get a well-defined environment, you chroot to this directory using a script appropriately called

cd /mnt/HD_a2/ffpbuildenv/
cd /mnt/HD_a2/ffpbuildenv/source/

It makes the ffpbuildenv look like the root directory of the file system, at least for the current process. Note that the chroot step creates a new command shell running within your current command shell: if you later exit from the that shell, you end up back in the original shell.

Downloading the distribution file

cd /mnt/HD_a2/ffpbuildenv/source/

Compiling a package

cd /mnt/HD_a2/ffpbuildenv/source/

The compiled and packaged archive is placed in /mnt/HD_a2/ffpbuildenv/packages/ then. Errors are logged to /mnt/HD_a2/ffpbuildenv/build-logs/--.log

Setting up a package

If you take a look into the directory of a package, you will see several files. In the following text, I will describe lighttpd if not stated otherwise.

Required files


Tells the Revision of the compiled package. E.g. if you compiled a package, forgot to include something and want to redo the package, e.g. the third version of php-5.2.6: php-5.2.6-3.tgz



This is the version of the source code, e.g. lighttpd-1.4.20.tar.bz2



Link to the source-file. You can use the following variables:

  • $PV – Packageversion – Value from above
  • $PN – Packagename – Value from above
  • $P – Concated Variable: “Packagename-Packageversion” ($PN-$PV)$PV.tar.bz2

This will result in

Optional files


Describes the package. If present, it is shown during installation.

Lighttpd is a secure, speedy, compliant, and very flexible web-server
which is designed and optimized for for high-performance environments.
With a small memory footprint compared to other web-servers, effective
management of the CPU-load, and advanced feature set (FastCGI, SCGI,
Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the
perfect solution for every server that is suffering load problems.


This is the general homepage of the program.

This file gets executed during the installation of a compiled package. Here you can add additional commands, like adding system accounts or printing additional information.

This file is not needed in lighttpd, the code below is from sudo

        if [ ! -r "$1" ]; then
                mv $ $1
        elif cmp -s $1 $; then
                rm $
def ffp/etc/sudoers

This file is used for configuring the source code with other commands than ./configure. If it is not available ./configure with the optional configure_args (see below) will be run in the source directory.

This file is not needed in lighttpd, the code below is from openssl

    ./config \
        --prefix=$CPREFIX \
        --openssldir=$CSYSCONFDIR/ssl \
        zlib shared


These arguments are used, if there is no available in the directory. Only the part after ./configure is included!



This file is used for “make” on the source code. If it is not available,

make DESTDIR=$D install

will be used in the source directory.

This file is not needed in lighttpd, the code below is from screen

    make DESTDIR=$D install
    mkdir -p $D$CPREFIX/etc
    install -m 0644 etc/etcscreenrc $D$CPREFIX/etc/screenrc


Additional actions like moving or adding files. * can be replaced by etc or whatever, they all are run after compilation.

This is the content of

mkdir -p $D$CPREFIX/etc/examples
cd $X/etc/examples
install -m 0644 -o root -g root \
        lighttpd.conf lighttpd.conf-with-php \


These files get installed into the directory “/ffp/start/” during the installation. These contain a starter file.

This is the content of

# PROVIDE: kickwebs
# BEFORE: lighttpd
. /ffp/etc/ffp.subr
        echo "Kicking webs ..."
        killall webs
run_rc_command "$1"

This is the content of

# PROVIDE: lighttpd
. /ffp/etc/ffp.subr
lighttpd_flags="-f /ffp/etc/lighttpd.conf"
run_rc_command "$1"


Install an editor (like nano), you will need one for editing the above files.

This walk-through will show you how to compile nano.

We start by changing to the correct directory:

>cd /mnt/HD_a2/ffpbuildenv/source/

Now we create the directory and change to it:

mkdir nano
cd nano

We open for the latest stable version, which is 2.0.9. Open the file PV for the package version:
And enter 2.0.9.

Reset PR, we do this process for the first time. Open PR:
And enter 1.

Now we search for the [ download-url]. Is there a consistent way of numbering the releases? The example of nano shows us this numbering:

Do you see the similarity?
If so, then we can substitute the version by using $PV:$PV.tar.gz

If not, you need to enter the url manually:

Pull this URL to SRC_URI.

Now we fulfilled the requirements for compiling, but nano will fail in some sections with these settings due to missing libraries (spellchecker). So we need to add some configure arguments using configure_args:


Now everything is set for compiling. Now we chroot to the respective directory:

sh /mnt/HD_a2/ffpbuildenv/
cd /mnt/HD_a2/ffpbuildenv/source/

And run the download:

./ -F nano

And run the compilation:

./ nano

This will take a while. If you get you prompt back and the line above states “OK.” everything went fine and you will find the final package in /mnt/HD_a2/ffpbuildenv/packages/. Otherwise, you should check the log:

tail /mnt/HD_a2/ffpbuildenv/build-logs/nano*log

Installation of phpMyAdmin on Fonz fun_plug

What is phpMyAdmin

Quote from Wikipedia:

phpMyAdmin is an open source tool written in PHP intended to handle the administration of MySQL over the World Wide Web. It can do various tasks such as creating, modifying or deleting databases, tables, fields or rows; executing SQL statements; or managing users and permissions.

The installation on the NAS-Device requires a working lighttpd with php and the MySQL-Database server. Please follow the respective tutorials for the installation of these.

Download and unpacking

Check the homepage of phpMyAdmin for the current version and download it. As of 13-Dec-2010, this latest non-beta version is

cd /srv/www/pages/
tar -zxf phpMyAdmin-
rm phpMyAdmin-
mv phpMyAdmin- phpmyadmin

Now you have a directory called phpmyadmin in the webroot of your lighttpd.


Now we need to add a configuration-file for phpmyadmin. We use nano for this:

cd /srv/pages/phpmyadmin/

Simply copy the content below to this file:

/* Servers configuration */
$i = 0;
/* Server localhost */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'http';

Errors and Remarks

  • The auth_typehttp” was chosen as cookie is extremely slow without the php-extension mcrypt which is not compiled into the current php-versions
  • If you get an error with the code #2002, you have to change the host to “” and add a comment in the file my.cnf of mysql on the line skip-networking
  • If you get the error The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results, you have to enable the mbstring-extension in the php.ini of your NAS.


Now you should see phpmyadmin under http://CH3SNAS/phpmyadmin (substitute CH3SNAS with the network-name of your NAS-Device).
For further information consider reading the documentation online. for the DNS-343 and Acer easystore NAS

Fonz Version of the for the DNS-343 and the Acer easystore NAS can be downloaded like this:

wget -O /ffp/sbin/

The Content of this script is the following:

echo "Mounting flash ..."
mount -t minix /dev/mtdblock0 /sys/mtd1
mount -t minix /dev/mtdblock1 /sys/mtd2
echo "Updating files ..."
for d in /sys/mtd1 /sys/mtd2 /mnt/HD_a4/.systemfile/AccountFile /mnt/HD_b4/.systemfile/AccountFile; do
    if [ -d "$d" ]; then
	for f in /etc/passwd /etc/group /etc/shadow /etc/samba/smbpasswd; do
	    b=$(basename $f)
	    if [ -e "$d/$b" ]; then
		echo "  $d/$b"
		cp -f $f $d
echo "Unmounting ..."
umount /sys/mtd1
umount /sys/mtd2
echo "Done."

Inspired by this Thread, i (Uli) did a rewrite of the You need to use BASH for this to execute. Better use the Script above if you are not sure!

# This script was written by Ulrich Wolf <ffp [a] wolf-u [dot] li>
# Inspired by the original Scripts of fonz and OneArmedMan
# Defining the various locations for these files:
# Defining the backup-locations of the files
# Inactive Files
# Mounting the internal DRAM
mount -t minix /dev/mtdblock0 /sys/mtd1
mount -t minix /dev/mtdblock1 /sys/mtd2
# Iterate through the files for backup of the files
for BUFILESEQ in $(seq 0 $((${#BACKUPFILE[@]} - 1)))
	# Iterate through the backup-locations of the files
	for BULOCSEQ in $(seq 0 $((${#BACKUPLOCATION[@]} - 1)))
			# File exists, copy the original one
			echo -n "${BACKUPFILE[$BUFILESEQ]##*/} found in ${BACKUPLOCATION[$BULOCSEQ]}, copying"
			cp -f ${BACKUPFILE[$BUFILESEQ]} ${BACKUPLOCATION[$BULOCSEQ]}/. 2> /dev/null && echo "done" || echo "failed"
			# File does not exist, skip
			echo "${BACKUPFILE[$BUFILESEQ]##*/} not found in ${BACKUPLOCATION[$BULOCSEQ]}, skipping"
echo -n "Flushing unwritten filesystem I/O buffers..."
sync && echo "done" || echo "failed"
# Unmount the internal DRAM
umount /sys/mtd1
umount /sys/mtd2
echo "Backup complete"
exit 0

Installation and Configuration of MySQL on Fonz fun_plug

This tutorial is deprecated and should only be used with fonz fun_plug 0.5!
Please check the tutorial page for updated tutorials on this topic!

MySQL is an open source database management system (RDBMS) provided by a commercial company acquired by Oracle. Although the software is free, the company provides commercial support and consultancy (this is a similar model to certain Linux distributions).

Logo of MySQL
An RDBMS is a software tool to store, access and update (often large) amounts of data structured as interrelated tables. Originally, databases were typically used for adminstrative purposes such as storing employee- or inventory information. Nowadays, databases are also widely used to store the raw content from which dynamic web sites are generated. This allows the same information to be presented in different ways. Because SQL is a standardized language to update or access an RDBMS, it also avoids relying on proprietary storage formats with associated risks of obsolescence or lock-in to particular software.

Although there are various other open source and commercial RDBMS systems available, MySQL is commonly used in web development in conjunction with Linux, Apache (or lighttpd), and php. Wikipedia, for example, runs on MediaWiki software written in PHP and uses a MySQL database.


Setting up MySQL


Uli kindly provided a packaged version of MySQL for the NAS in his repository.

MySQL is not installed as part of fun_plug by default, but you should already have downloaded a copy as part of the general tutorial on how to download, install and upgrade packages. Let’s first make sure you still have the latest version (as Uli upgrades his repository regularly).

Note that the installation command below could take a while:

funpkg -i /ffp/pkg/additional/*/mysql-*.tgz

If you have a version of mysql installed that is outdated, you will need to run in upgrade mode instead (see here for help):

funpkg -u /ffp/pkg/additional/*/mysql-*.tgz


MySQL can be configured with a file called my.cnf. After installation you can configure several MySQL settings by copying an example-file from /ffp/etc/examples/mysql/ to /ffp/etc/:

cp /ffp/etc/examples/mysql/my-small.cnf /ffp/etc/my.cnf


MySQL stores the data of its databases in files which are in turn stored in a directory named /srv/mysql/. Instead of creating the directory at that location, you may prefer to create a symbolic link from /srv/ to the target-directory of your choice.
First we create it:

mkdir -p /ffp/opt/srv/mysql
mkdir -p /ffp/opt/srv/tmp/mysql

Now we link it to /srv/:

ln -s /ffp/opt/srv/ /srv

This link will be lost after rebooting the device, so you have to add the following two lines to the end of the file /ffp/etc/fun_plug.init to recreate the link every time the NAS boots. You can edit this file using an editor like nano:

# create custom link to the server-folder
ln -s /ffp/opt/srv/ /srv


MySQL needs some internal databases for the initial startup which can be installed by issuing the mysql_install_db command:

cd /srv/
ls -al
ls -al

This results in several warnings (which you can ignore) about adjusted sizes system- and help tables. Typical partial output:

081116 22:05:32 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
081116 22:05:32 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
081116 22:05:32 [Warning] option 'myisam_max_extra_sort_file_size': unsigned value 2147483648 adjusted to 2147483647
081116 22:05:32 [Warning] option 'thread_stack': unsigned value 65536 adjusted to 131072

Now we manually start the MySQL server for further configuration:

sh /ffp/start/ start

Note that you will have to press Enter to get your prompt back (unlike other daemons).

After the first start, we have to secure the installation:


You will be asked several questions (shown below in abridged form) and can answer Y(es) for each of them.
For "Enter current password for root (enter for none):" you press enter because the default root password is empty.
For the new root password, it is best to use a different password than the user root of the system: this is just for owning the administration rights to the database and is unrelated to overall control over the machine.

Enter current password for root (enter for none):
OK, successfully used password, moving on...
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
All done!

To activate this service permanently on every boot you need to enter this command:

chmod a+x /ffp/start/

Testing MySQL

After MySQL has started, you can test your installation using the following ways:


Enter the following command on the command-line:

mysql -p

This will open a special mysql-command-line, where you can enter regular SQL-Commands. Now change to the database “mysql”:

USE mysql;

Then select the Host, User and Passwort from the Database:

SELECT Host, User, Password FROM user;

Finally exit the mysql-command-line:


A sample output will look like this:

root@CH3SNAS:/srv/mysql# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.67 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> USE mysql;
Database changed
mysql> SELECT Host, User, Password FROM user;
| Host      | User | Password                                  |
| localhost | root | *8D2414F01991E3B0B86E14D2469EACA0B6D78B99 |
| CH3SNAS   | root | *8D2414F01991E3B0B86E14D2469EACA0B6D78B99 |
| | root | *8D2414F01991E3B0B86E14D2469EACA0B6D78B99 |
3 rows in set (0.01 sec)
mysql> exit;

By the way: As you can see, passwords are crypted (in this case it was ““).


For the following, you need to install lighttpd and php in case you haven’t already done so.
You also need to enable the mysql module of lighttpd by editing the /ffp/etc/php.ini file:

; Linux extensions

Make sure you define the folder which contains all the above modules in line 536 of the php.ini file. Usually it should be:

extension_dir = "/ffp/lib/php/extensions/no-debug-non-zts-20060613/"

You will need to restart the web server if you enabled the my-sql extension, or changed the extension_dir using:

sh /ffp/start/ restart

Then place a file called testmysql.php in the document-root (as configured here e.g. /srv/www/pages) with the following content (replace YOURROOTPASS with the password of mysql user root):

// Connect to the database
mysql_connect("localhost", "root","YOURROOTPASS");
// Select the database "mysql"
// Query the database for the Users:
$result = mysql_query("SELECT Host, User, Password FROM user;");
// Print the results
while($row = mysql_fetch_object($result))
	echo $row->User . "@" . $row->Host . " has the encrypted password: " . $row->Password;
// Close the connection to the database

If opening this page in your browser doesn’t give the expected results, check the password, and if needed close and open the browser again.

When you are done, you may want remove the root password (or delete this .php file) to avoid exposing the mysql password in the line mysql_connect("localhost", "root","YOURROOTPASS");.

Users and privileges

Adding additional Users

As you should never use the root-password of your database, you can add additional users in the mysql-command-line (enter “mysql -uroot -p” on the command-line).
Please consult the mysql-manual for more examples.

  • A User with all privileges, who can only connect from localhost:
  • A User with limited privileges, who can only connect from localhost:
  • A User with limited privileges on a certain database:
    CREATE DATABASE databasename;

After you send add or alter the rights, please make sure, that these get loaded by executing the following command in the mysql-command-line:


Allowing external access

Per default external access is not allowed as this is a security risk. But many tools like HeidiSQL or other external administrator-programs rely on access from the outside of your NAS.

Caution: You should explicitly check the rights of your users! All MySQL-users should have passwords!

First follow the section on “running mysql under a user with limited rights“, then follow these instructions:

Stop the mysql-server:

sh /ffp/start/ stop

Edit /ffp/etc/my.cnf and add a comment to the line skip-networking, so that it looks like this:


Edit /ffp/start/ and find the line beginning with mysqld_flags and remove “--skip-networking” between the two quotation marks. Save the file afterwards.

Running mysql under a user with limited rights

Per default the MySQL gets started with root-rights. This means, that if the MySQL-server is breached by a intruder, the system probably can be corrupted. Be advised to use the mysql-server only in secure areas (e.g. your local LAN without internet access) and to disable external access (default).

If you want to secure your installation please follow the following steps:

Stop the mysql-server:

sh /ffp/start/ stop

Add a new user with limited rights:

useradd -U -s /bin/false mysql

This will create a user mysql who is in the group mysql (-U add a new group) and who cannot log in. It will probably show up in the Webinterface, but cannot be used!

This user needs access to the directories of MySQL:

cd /srv
chown -R mysql:mysql mysql
cd /ffp/var/run/
chown mysql:mysql mysql

Edit /ffp/start/ and find the line beginning with mysqld_flags and remove “--user=root” between the two quotation marks. Save the file afterwards.

Then start MySQL again:

sh /ffp/start/ start

With these changes, MySQL is started under the user mysql.

Removing MySQL

If you want to remove MySQL and its databases, you proceed like described in the general tutorial on packages.
First, stop mysql:

sh /ffp/start/ stop

Then remove the package with funpkg:

funpkg -r /ffp/pkg/additional/*/mysql*.tgz

Afterwards you have to remove the databases (careful!). Change to the folder /srv/ and delete the folder mysql:

cd /srv/
rm -R mysql

Furthermore, you should undo the change in /ffp/etc/fun_plug.init, possibly remove the (harmless) symbolic link /srv/, but especially disable execution of the startup script:

chmod a-x /ffp/start/

Voilá, MySQL is removed.

Installation and Configuration of the Webserver lighttpd for Fonz fun_plug

This tutorial is deprecated and should only be used with fonz fun_plug 0.5!
Please check the tutorial page for updated tutorials on this topic!

The lighttpd daemon is a lightweight web server. Its main task is to respond to HTTP requests. In other words, it allows HTTP clients (such as Internet Explorer and Firefox) to retrieve hyperlinked HTML pages stored on a web site stored on the CH3SNAS.

In terms of complexity, lighttpd lies between the basic GoAhead HTTP server (which comes with the CH3SNAS) and an Apache server.


Example uses

The lighttpd server allows you to build a web site which is accessible via your local area network (LAN). If you configure your router’s firewall properly, you can also let others access the website via the Internet. Opening your firewall to give access to outside HTTP requests obviously requires paying some attention to security.

A basic web site consists of a collection of HTML pages which provide text, links, images, documents, etc. HTML pages can be written with an ASCII editor. There are numerous books and online tutorials on how to create basic and advanced web pages directly in HTML. This can be worth trying if you want to understand how the World Wide Web works: HTML is the main technology behind WWW.

In recent years, however, the average web page has gotten increasingly sophisticated in terms of its technical and visual design. Furthermore, the content of many web sites has become dynamic: what you see in your browser often changes daily (the weather, the news, a blog, photos). Such dynamic HTML pages are generated (by running programs or scripts) whenever the set of HTML pages needs to be updated, or are created on the fly whenever the server receives a page request.

Some examples of what you can do with a web site consisting of basic, static HTML served via lighttpd:

  • a basic home page telling who you are
  • a set of pages about your hobby, your recipes, or reporting on your holiday trip (all with embedded pictures)

Using this approach you “program” your page using the HTML language.

Examples of ways to generate ”’fancier static HTML”’ pages using software:

  • Microsoft Word can generate a HTML version of a document (including formatting, links and pictures)
  • professional photographers may use Photoshop Lightroom to generate an online gallery of sample pictures

Using this approach you use software to generate the HTML pages. This means you don’t need to learn (much) HTML, but instead need to learn how to use the (often fancy) software. All-in-all this can save you some typing and helps generate a uniform look for the web site.

Examples of applications involving generating dynamic HTML pages:

  • a Blog or Forum contains HTML forms that allow users to type in text that is appended to certain pages. Example: NAS-Tweaks uses a PHP server and software by WordPress for its Blog. Often this approach uses a database like MySQL to store and manage the raw data used to generate the HTML.
  • many well-known Web 2.0 sites that provide a service for you (WikiPedia, Google Maps, YouTube, Flickr)

Using using this approach, software generates HTML pages on demand, keeps the pages updated, and allows interaction with the user. If you go overboard on this, and manage to get the users of your website to provide content which keeps you web site interesting, you can call this Web 2.0 and tell your friends you may become rich – someday.
This kind of software is often known as Content Management Systems and includes engines like Drupal, Joomla, Mediawiki (as used by Wikipedia) and WordPress (as used for blogs).

Setting up Lighttpd


By default a lighttpd is already installed with the fun_plug packages. But there is an update available. Before you can install it, be sure to synchronize my repository. Then update using the following command:

funpkg -u /ffp/pkg/additional/*/lighttpd-*.tgz

If you didn’t install all packages from the “packages”-directory (why not?), you should execute at least the installation of the OpenSSL-package:

funpkg -i /ffp/pkg/packages/openssl-*.tgz


The default lighttpd configuration needs a small directory tree where it can store logfiles and retrieve the data to display to the users. Instead of creating the directory at that location, you may prefer to create a symbolic link from /srv/ to the target-directory of your choice.

mkdir -p /ffp/opt/srv/mysql
ln -s /ffp/opt/srv/ /srv

This link will be lost after rebooting the device, so you have to add the following two lines to the end of the file /ffp/etc/fun_plug.init to recreate the link every time the NAS boots. You can edit this file using an editor like nano. Use the following for all NAS other than the DNS-320 or DNS-325:

# create custom link to the server-folder
ln -s /ffp/opt/srv/ /srv

Now create the folders for the webserver:

mkdir -p /srv/www/pages
mkdir -p /srv/www/logs
mkdir -p /srv/tmp

The folder /srv/www/pages is the default location for the web site itself. The location is set via a parameter called server.document-root in the /ffp/etc/lighttpd.conf file. This means that any directories below server.document-root are visible via the HTTP server (careful), while any other directories are not visible.

The folder /srv/www/logs is for log files in which lighttpd can record what happened.

HTML test pages

Within the www folder, you should create a home page named index.html containing the following ASCII text. Note that the indentation is only for readability and can be (and often is) omitted. You don’t need to worry about using Linux or Windows end-of-line conventions here (both work). You may have to adapt the line CH3SNAS:81 to reflect the network name of your NAS or use its IP address instead (e.g.

        <title>Hello world</title>
        <style type="text/css">
                h1 {text-align:center;
                    font-family:Arial, Helvetica, Sans-Serif;}
                p  {text-indent:20px;}
    <body bgcolor="#ffffcc" text="#0000ff">
        <h1>Hello, CH3SNAS Tweak'n World!</h1><p>
        <A HREF="page1.html">Link to local page1</A><p>
        <A HREF="page2.html">Link to local page2</A><p>
        <A HREF="http://CH3SNAS:81">Configure the CH3SNAS</A><p>
        <A HREF="">external link to the Lighttpd tutorial</A>

The HTML code consists of a head and a body section. The head contains the title (shown at the top of the browser window) and, in this case, defines formatting styles for Header1 and new paragraph (<p>).
The body starts with a header, followed by four links (“<A>nchors”) to other pages, to the original HTML configuration page for the CH3SNAS (on port 81 instead of the default 80) and a link to a remote web site.

Then create page1.html in the same directory containing:

        <title>Page #1</title>
        <style type="text/css">
                h1 {text-align:center;
                font-family:Arial, Helvetica, Sans-Serif;}
                p {text-indent:20px;}
    <body bgcolor = "#ffffcc" text = "#0000ff">
        <h1>Page 1</h1><p>
        <A HREF="index.html">Home</A><p>
        <A HREF="page2.html">Link to page2</A><p>

Similarly you can create page2.html in the same directory:

        <title>Page #2</title>
        <style type="text/css">
                h1 {text-align:center;
                font-family:Arial, Helvetica, Sans-Serif;}
                p {text-indent:20px;}
    <body bgcolor = "#ffffcc" text = "#0000ff">
        <h1>Page 2</h1><p>
        <A HREF="index.html">Home</A><p>
        <A HREF="page1.html">Link to page1</A><p>

Enabling lighttpd

This tutorial assumes that fun_plug is installed and that you have installed the additional packages (these include lighttpd). You can test whether lighttpd is installed using

which lighttpd

on the ssh command line. If it is installed, it will respond with the location of the lighttpd script file: /ffp/sbin/lighttpd.

Waking up daemons

Next we need to enable the lighttpd server from the command line (see the packages tutorial for a detailed explanation):

chmod a+x /ffp/start/

and enable a script which disables the standard HTML server called webs (if you are running a DNS-320 / DNS-325 please skip this step and go to the following section):

chmod a+x /ffp/start/

The standard “webs” server then restarts automatically within a few minutes, but moves to port 81 because the standard HTTP port (80) is already occupied by the lighttpd server.

If you are running a DNS-320 or a DNS-325, you need to enable “” for kicking the internal lighttpd (which is used for the Webinterface of the Device) from Port 80:

chmod a+x /ffp/start/

Note that the chmod commands only take effect on the next reboot. If you would reboot now, however, nothing changes. If you want to try, you can see test this manually using:

sh /ffp/start/ start # When you run a Device other than DNS-320 / DNS-325
sh /ffp/start/ start # When you run a DNS-320 / DNS-325
sh /ffp/start/ start

Unless you have installed the server before, you will get the error message /ffp/etc/lighttpd.conf: Required file not found or not readable. Which, by Linux standards is an unusually clear error message: a file with configuration settings for lighttpd is missing in the /ffp/etc directory (see the packages tutorial for more explanation).


We can resolve the missing /ffp/etc/lighttpd.conf file by copying the file from the directory /ffp/etc/examples/. If you are not on a DNS-320 or a DNS-325 and you don’t need PHP, then run the following command:

cp /ffp/etc/examples/lighttpd.conf /ffp/etc/

This copies one of the two supplied configuration files from the /ffp/etc/examples subdirectory to the /ffp/etc directory.
if you want to run PHP and you are not on a DNS-320 or a DNS-325, then run the following:

cp /ffp/etc/examples/lighttpd.conf-with-php /ffp/etc/lighttpd.conf

If you are on the DNS-320 or DNS-325, you have no choice but to run the Webserver with PHP (Please configure PHP before you try starting lighttpd again!):

cp /ffp/etc/examples/lighttpd.conf-dns320 /ffp/etc/lighttpd.conf

Port insight

Next we can try starting lighttpd manually again to see how we are doing:

sh /ffp/start/ start # When you run a Device other than DNS-320/DNS-325
sh /ffp/start/ start # When you run a DNS-320 / DNS-325
sh /ffp/start/ start
sh /ffp/start/ status

Example HTML page being hosted by Lighttpd
As, this suggests that lighttpd is now happily running, we try typing http://CH3SNAS:81 in the address bar of your Web browser. Note that if your network name for the device differs from “CH3SNAS“, use that name or its IP address instead. You should now get the standard configuration screen. Please remember the :81 port number in case you need to access it in the future (it is one more than the standard port 80 used for HTTP servers – which you can look up on the internet). You can close that screen – it was only to demonstrate that did its job.

We now try entering http://CH3SNAS in the address bar of the Web browser. If all goes well, you will see the expected web page.

To boot or not to boot

Remember that you now have a lighttpd running on port 80 each time you boot the NAS. If you want to connect to the Webinterface of the NAS, connect to Port 81.

Testing Lighttpd

At this point, you can enter any of the following into your browser’s address bar (assuming CH3SNAS is the correct network name of your NAS):

  • http://CH3SNAS:80/index.html
  • http://CH3SNAS:80 – index.html is a default for browsers
  • http://CH3SNAS – port 80 is default for HTTP
  • CH3SNAS – http is the default protocol for web browsers


The log files

The directory /srv/www/logs contain log files which respectively record the access to the server and any errors (including starting and stopping) reported by the server.

-rw-r--r-- 1 root  root    0 Oct 19 17:06 access.log
-rw-r--r-- 1 root  root   48 Oct 19 17:06 error.log

The file access.log contains timestamped records which are appended whenever a file on the server is accessed via HTTP (which file, which IP address, HTTP statuscode, browser used). Here is a schematic line from the access.log file:

client_IP server_URL - [date:time +0200] "GET /path/file_1.jpg HTTP/1.1" status_code file_length "-" "client_browser_type"

If you want to clear the log files, one quick-and-dirty way to do so is to delete them and restart the CH3SNAS. The lighttpd server will regenerate the log files when it is started. A quicker approach is to restart the lighttpd server using:

rm /srv/logs/access.log
cd /ffp/start
sh restart

Now What?

You should now install PHP if not already installed and try using MySQL. Have fun 🙂

Installation and Configuration of fanctl for Fonz fun_plug

This tutorial is deprecated and should only be used with fonz fun_plug 0.5!
Please check the tutorial page for updated tutorials on this topic!

The CH3SNAS, as well as other small nas devices, has a small fan at the back. This fan is necessary because the NAS can generate significant amounts of heat when one or two drives are used heavily.

Although the fan is speed-controlled through software provided by Conceptronic, the fan never switches off completely. Some people find this too noisy for quiet environments like bedrooms or even some offices. An obvious solution is to turn the CH3SNAS off entirely when it is not in use (e.g. at night), but this is very inconvenient and it gives problems when the CH3SNAS may be accessed occasionally by remote (Internet) users.

Thanks to the fun_plug, the user can change the fan control algorithm to reduce noise, save a bit of power and reduce wear on the fan itself.


  1. Replacing the default fan control software
    1. The standard fan control solution
    2. Using shell scripts versus using binaries
  2. Installation
    1. Installing fanctl
    2. Activating fanctl
  3. How fanctl works
    1. Warning!
    2. The graph
    3. Temperatures
    4. Fan speed
    5. Changing fanctl.conf
  4. Notes
    1. A CH3SNAS in a hot room
    2. Shut down on overheating
    3. Logging the temperature
    4. Deinstallation

Replacing the default fan control software

The standard fan control solution

By default, the fan is controlled by a program embedded within the CH3SNAS called fancontrol. This program adjusts the fan speed depending on the temperature measured inside the CH3SNAS.

Conceptronic also provides two other utilities which are helpful to control the fan:

  • temperature – shows the actual temperature (on some devices in Fahrenheit and on others in Celsius) by entering the command "temperature g 0"
  • fanspeed – returns the current fan speed when you enter "fanspeed g". It can also set a new fan speed by entering the command "fanspeed w YourFanSpeed" (where YourFanSpeed is the desired speed in Rotations Per Minute).

Using shell scripts versus using binaries

There are different ways to control the fan. In any case the new software needs to stop (“kill”) the built-in fancontrol program provided by Conceptronic before it takes over control.

One approach is to use the programs temperature and fanspeed within a simple bash script that repeatedly measures the temperature and adjusts the fan speed accordingly. Such a script can even choose to turn off the fan entirely below a certain temperature. But a script-based approach, which, compared to a compiled C program, uses more (valuable) memory and CPU cycles.

Fortunately Fonz, the author of fun_plug, has written a small and efficient binary program named fanctl. It controls the fan without relying on the temperature and fanspeed) programs and without using the bash shell. This efficiency is nice as the program is intended to run as long as the CH3SNAS is powered up. By default, fanctl adjusts the fan speed every 30 seconds if needed.


Installing fanctl

Uli has created a package to simplify installation of fanctl.

In this tutorial we assume that the fun_plug is already installed on the NAS and that you synchronized Uli’s repository (see here for instructions on how to do this). Afterwards install the package (see detailed instructions here):

funpkg -i /ffp/pkg/additional/ffp-misc/fanctl-*.tgz
cp /ffp/etc/examples/fanctl.conf /ffp/etc/fanctl.conf

The final steps copies default configuration settings to the appropriate directory.

Activating fanctl

Please make sure, that no other scripts than the original fancontroller are active! You can check this by:

ps aux|grep fan

This should show the following output (the process identification numbers will vary):

1431 root fancontrol
12620 root grep fan

These are all the running processes (ps) which were filtered (grep) on whether they include the text fan somewhere in their name. Despite appearances, [ aux] is not a command or name, but 3 separate options for ps with a missing “-” this time.

Now test the first run of the fanctl script by entering the following command on the command line:

sh /ffp/start/ start

After entering the above command, the fan will run with a audible noise for a few seconds. You can check the correct opertion of fanctl now:

ps aux|grep fan

This should show the following output (again the PID numbers will vary):

12628 root     /ffp/sbin/fanctl /ffp/etc/fanctl.conf
12635 root     grep fan

This shows that the fancontrol process disappeared and was replaced by the fanctl process (with its configuration file).

As the last step, you can activate the daemon permanently:

chmod a+x /ffp/start/

How fanctl works

To understand or to adjust the behaviour of fanctl, you may want to inspect its configuration file /ffp/etc/fanctl.conf. If you use the nanoeditor:

nano /ffp/etc/fanctl.conf

Under normal circumstances the defaults should be fine.


Do not change these values unless you completely understand the consequences.
Overheated hard drives can lead to data loss or early drive failure. So if you want to change the settings in the configuration file, please study the following documentation carefully and test any modifications you make carefully.

The graph

The graph (by Uli) explains how the program adjusts the fan speed. It assumes the default settings (which you won’t change unless you need to and know what you are doing – right?). Room temperature is typically about 20 degrees Celcius (68 degrees Fahrenheit).

Fanctl adjusts the fan speed depending on the measured temperature

When you boot the CH3SNAS, but hardly use the drives the temperature should increase a few degrees, but stay well below 40 degrees. In that case, the fan follows the blue line: it stays off because there is no real need to cool the CN3SNAS yet. However, when you use the drives a lot, the temperature can rise above 40 degrees. Especially if the room temperature also happens to be hot. This causes the fan to switch on. The fan speed (in RPM) follows the curved slope (part of a parabolic curve). The maximum fan speed is limited by default to 6300 RPM (called pwm_hi). Like the original software, there is a actually a safety threshold as well: above 51 degrees, the CN3SNAS is turned off. The latter shouldn’t normally happen unless something goes very wrong (like a broken drive, or operating your CH3SNAS in the sauna).

Now assume that the CH3SNAS has become relatively hot (say 45 degrees Celcius), but the drives now enter a period of infrequent access. This causes the drive motors to automatically shut down, reducing heat production and causing the temperature to drop. Every 30 seconds, a drop in temperature will cause the fan to slow down. When the temperature drops below 40 degrees (called temp_hi) the fan speed stabilizes for a while. When the temperature then drops below 37 degrees (called temp_lo), the fan is turned off.

Note that turning the fan on and off occur at different temperatures. This is called (hysteresis). This reduces the chance that at some temperature the fan repeatedly runs for 30 seconds, then turns off for 30 seconds, and then turns on again.


If you want to change the temperatures (e.g. if the fan never switches off completely (NAS too warm) or you want to cool it down to a certain level), there are various values in the script for configuring these. All values have to be set in Celsius*1000! E.g. 40°C would be 40000

There are four different values:

  • temp_stop: If the temperature decreases below this value, the fan is set to the speed, which is configured as the variable pwm_stop (normally this will be zero and thus stops the fan). If the temperature rises about this temperature, nothing happens (hysteresis). Default is 37 degrees Celcius.
  • temp_lo: If the temperature rises above this temperature, pwm_start will be set for one second (Starts the fan). After this, the fan speed will be adjusted somewhere beween pwm_lo and pwm_hi – depending on the measured temperature. If the temperature drops below this temperature, the fan runs at pwm_lo (hysteresis). Default is 40 degrees Celcius.
  • temp_hi: If the temperature rises above this value, pwm_hi is set as fan speed. Default is 50 degrees Celcius.
  • temp_crit: If the temperature rises above this value, the CH3SNAS is shut down to prevent damage. Default is 51 degrees Celcius. Be extra careful with this value.

Fan speed

If you want to change the fan speed (e.g. if you think, the fan turns too slowly or if you want the fan to idle and not to stop), there are various values in the script for configuring these.

  • pwm_stop: This is the speed which is set below temp_stop. If set to zero, the fan will halt. It may not be a good idea to use really low non-zero values here (difficult to run the fan smoothly at these speeds).
  • pwm_start: This is the speed which is set for one second if pwm_stop was set and the temperature rises above temp_lo again. (Default: 3200 rpm)
  • pwm_lo: This is the speed which is set at temp_lo. (Default: 2700 rpm)
  • pwm_hi: This is the speed which is set at temp_hi. (Default: 6300 rpm)

Between pwm_lo and pwm_hi the fan speed will be interpolated according to the following formula:

RPM = (pwm_hi - pwm_lo) * (temp - temp_lo) / (temp_hi - temp_lo) * (temp - temp_lo) / (temp_hi - temp_lo) + pwm_lo

Changing fanctl.conf

Again, editing fanctl.conf should be done with care. Just editing the file will not cause the new values to be used immediately because the running program reads the file once when it starts. One safe way to reload a modified /ffp/etc/fanctl.conf file is to simply reboot the CH3SNAS. When the program is started, it will load the modified /ffp/etc/fanctl.conf file. Another way is to use

cd /ffp/start
sh status
sh restart
sh status

The sh retart stops and restarts the fan. Actually between the stop and the restart, fancontrol is briefly run.


A CH3SNAS in a hot room

According to the graph, if you put the CH3SNAS in a very hot environment (e.g. 38 degrees Celcius), the fan will turn on – even when the hard disks are not being used. Turning the fan on wouldn’t help lower the device temperature: it will only get the device temperature closer to room temperature. Currently the software cannot distinguigh this condition (but this obviously also applies to the default fancontrol software which never turns the fan off).

Shut down on overheating

In exceptional conditions, the CH3SNAS will shut down if it ever reaches temp_crit (typically 51′ Celcius). When it shuts down, it will create a file named OVERHEAT in the root directory. By checking for this file and its creation or modification time, you can get confirmation about the cause of the shutdown.

See the file /ffp/etc/fanctl.conf for more details how this works.

Logging the temperature

From an E-mail exchange with fonz (this hasn’t been tested):

PeterH> Other features might be more fun (e.g. log of temperature?).

That’s pretty easy. Just change /ffp/start/ and replace

/ffp/sbin/fanctl $fanctl_config >/dev/null 2>/dev/null </dev/null &


/ffp/sbin/fanctl $fanctl_config >/mnt/HD_a2/fan.log 2>&1 </dev/null &

You can plot nice graphs from the log file using gnuplot:

gnuplot> set timefmt "%Y-%m-%d %H:%M:%S"
gnuplot> set xdata time
gnuplot> plot '< grep fan /path/to/fan.log' u 1:4 w st, '' u 1:8 w st


If you deinstall fanctl using

funpkg -r /ffp/pkg/additional/fanctl-2-1.tgz

and reboot your CH3SNAS, you will find using

ps aux|grep fan

that the original fancontrol appication automatically reappears. This is because fanctl is activated via a script (/ffp/start/ that stops the default fancontrol process before starting the fanctl program.

This implies that deinstalling funplug and rebooting will also return fan behaviour back to the default behavior and default mechanisms provided by Conceptronic.

Installing and Uninstalling Packages and Activation and Deactivation of Daemons in Fonz fun_plug 0.5

After installing Fonz’ fun_plug (see tutorial on this), you will probably want additional packages or Daemons like NFS or Torrent.

The commands below are ONLY for fun_plug Version 0.5
Please check here for newer tutorials!

Continue reading Installing and Uninstalling Packages and Activation and Deactivation of Daemons in Fonz fun_plug 0.5

Installation of nano on fun_plug 0.5 for CH3SNAS, CH3MNAS, DNS-323 and many more

This tutorial is deprecated and should only be used with fonz fun_plug 0.5!
Please check the tutorial page for updated tutorials on this topic!

After the installation of the fun_plug the only available editor is “vi”, which is not really considered a “newbie“-friendly editor. The nano editor is much easier to use and largely self-explanatory. If you nevertheless want more information on the GNU nano editor, see its home page.


In this tutorial we assume that the fun_plug is already installed on the NAS and that you synchronized Uli’s repository (see here for instructions on how to do this). Afterwards install the package (see detailed instructions here):

funpkg -i /ffp/pkg/additional/app-editors/nano*.tgz

Move the configuration-file nanorc from /ffp/etc/examples/ to /ffp/etc/ to get syntax highlighting.

mv /ffp/etc/examples/nanorc /ffp/etc/


Screenshot of nano running in a PuTTY window
Simply enter “nano ” on the commandline (replacing "" with the name of the file you want to edit).

Basic commands

The commands are shown at the bottom of the nano screen. The main commands are:

  • CTRL + G => Get Help
  • CTRL + O => WriteOut (“Save”)
  • CTRL + W => Where Is (Search for a string in the file)
  • CTRL + C => Cur Pos (Shows the line & column number of the current cursor-position)
  • CTRL + X => Exit (Self explanatory)
  • CTRL + T => Spell checking (if aspell is installed)

Syntax highlighting

To have syntax highlighting for a certain language you have to uncomment it in /ffp/etc/nanorc. Example for PHP:

## PHP
#include "/ffp/share/nano/php.nanorc"

And remove the comment like this:

## PHP
include "/ffp/share/nano/php.nanorc"
Exit mobile version