fun_plug is the name of a script that will run after the DNS323 has booted (see fun_plug).
The fonz fun_plug (ffp) is a fun_plug script plus a collection of applications compiled and packaged by fonz. The system uses the DNS-323 fun_plug capability to hook your own start procedures to the startup.
To get started, read the README for current information.
Homepage: http://www.inreto.de/dns323/fun-plug/
There are also a number of blogs with helpful articles on the DNS-323 and fun_plug (listed in no particular order):
Homepage: http://www.inreto.de/dns323/fun-plug/0.5
README: http://www.inreto.de/dns323/fun-plug/0.5/README.txt
ChangeLog: http://www.inreto.de/dns323/fun-plug/0.5/ChangeLog.txt
Packages: http://www.inreto.de/dns323/fun-plug/0.5/packages
A list of all packages with descriptions and information about inter-package dependencies is available at http://www.inreto.de/dns323/fun-plug/0.5/PACKAGES.html
Sources:
svn co svn://inreto.de/svn/dns323/funplug/trunk funplug
For installation instructions, please follow the link for your device.
http://www.inreto.de/dns323/fun-plug/0.5/README.txt
http://forum.dsmg600.info/t2008-HOWTO%3A-DNS-313-fun_plug-dummies-them%29.html
http://forums.nas-central.org/viewtopic.php?f=131&t=191
If installation was successful, a telnet server has been started. It does not ask for user name and password, and directly start a root shell.
A telnet client utility is available by default in Windows XP and in most Linux distributions, but it's missing from Windows Vista and notably not available in Cygwin at all. Windows Vista has a telnet client which is disabled by default but can be enabled easily in Control Panel → Programs → Programs And Features → Turn Windows features on or off → Telnet Client.
See “The root user” below for more information.
The recommend upgrade method is to reinstall. Except for the fun_plug script, 0.5 will not overwrite any files of your 0.3/0.4 funplug. After successful installation of 0.5, you can cleanup your 0.3/0.4 files:
cd /mnt/HD_a2 rm -rf fun_plug.d
If you want to upgrade packages, use
cd /path/to/new/packages funpkg -u package-file.tgz
This will install the new version and remove any now obsolete files from the old version.
WARNING: Any configuration files, start scripts, etc will be overwritten with the versions in the new package. If you want to keep your changes, you need to backup your custom files and restore them after the upgrade. A simple way to create backups of your config files and start scripts is:
cd /ffp mkdir my-etc my-start cp -ar etc/* my-etc cp -ar start/* my-start
If you want to restore one or more files, e.g. the ssh config files:
cd /ffp cp -ar my-etc/ssh etc
'root' is the system administrator on Linux. A lot of tasks require root permissions, it's essential to have a working root account.
The firmware comes with a disabled root account that cannot login the 'normal' way. For this reason, the funplug starts an open telnet server that circumvents the normal login procedure to provide a root shell directly.
To fix the root account, you should run pwconv to update /etc/shadow, set a password and change the shell:
pwconv passwd usermod -s /ffp/bin/sh root
If you omit the usermod command, login will start the shell configured for root in /etc/passwd. Usually, this is the firmware shell /bin/sh (requires unlock code, type 5784468 and press Enter). For more information on shells, see the 'Shells' section below.
Before saving your changes, you should run additional checks on the password and group files. Some firmware versions duplicate the ftp user, and now is a good time to fix this, too.
pwck grpck
You may ignore warnings about missing home directories and invalid group names. If asked to remove a duplicate user, say 'yes' to remove one of them. Rerun the commands to check that it's fixed.
Test your changes with the login program:
login
If that worked, save the password files to flash memory:
store-passwd.sh
To enable login for telnet, edit the telnetd.sh start script and remove the '-l /ffp/bin/sh' option. You can do this from the command line like this:
cd /ffp/start sed -i '/flags/ s@^@#@' telnetd.sh
Restarting telnet while logged in via telnet requires special care (the telnet session will be aborted!):
cd /tmp nohup sh /ffp/start/telnetd.sh restart
Alternatively, you can disable telnet and start the SSH server instead. First, test ssh login:
cd /ffp/start sh sshd.sh start
Login from a remote host now (as root, of course). If it works, disable telnet and enable sshd permanently:
cd /ffp/start chmod a-x telnetd.sh chmod a+x sshd.sh
Reactivating telnet. If for some reason, sshd stops working or the root password is lost, the minimal fun_plug.tgz created by bq041 can re-enable password-less telnet: http://forum.dsmg600.info/p19176-Today-23%3A27%3A18.html#p19176
root without password. If you want to use the normal login to benefit from the better environment, but don't want to set a real password for root, you can remove root's password (login won't even ask for a password, then):
usermod -p '' root
This can easily be added to a start script. WARNING: ssh does not allow root to login without a password.
User login shells are stored in /etc/passwd. The default shell in /etc/passwd for all users is /bin/sh. The configured login shell is started when a user connects via telnet (with username and password) or ssh.
/bin/sh is included in the firmware. On D-Link and Conceptronic devices, you need to type the unlock code 5784468 and press Enter to get a prompt. The environment of /bin/sh does not include any ffp extensions (see also /ffp/etc/profile)!
ffp provides two alternative shells:
The root user can change login shells using chsh (or usermod) for all users:
chsh -s /ffp/bin/sh username
Remember to run 'store-passwd.sh' to make the changes permanent.
By default, only root can change login shells. You can allow each user to change her login shell herself by granting root permissions to the chsh program. As root, run:
chmod u+s /ffp/bin/chsh
To change their login shells, non-root users can now run:
chsh -s /ffp/bin/sh
or, if bash has been installed:
chsh -s /ffp/bin/bash
During startup, various scripts are run that you can enable, disable, and modify to your needs.
Scripts to start, stop, and restart various network servers and a few other functions are stored in /ffp/start/. The scripts that are marked 'executable' will be run automatically at startup. To activate a script, e.g. mediatomb.sh, run:
chmod a+x /ffp/start/mediatomb.sh
To remove the 'executable' flag, run:
chmod a-x /ffp/start/mediatomb.sh
Example configuration files for some services are included in /ffp/etc/examples.
Before the scripts in /ffp/start, /ffp/etc/fun_plug.local is run, if present and executable. You can use fun_plug.local for any commands you want to run during startup that don't fit in real start scripts. Examples:
/ffp/etc/examples/ contains an example fun_plug.local script. Note that you should set the PATH yourself early in in fun_plug.local. The fun_plug.local function was added in version 2008-08-11 of the fun_plug script.
Cleanboot (Proper shutdown): cleanboot 1.0 for DNS-323 / CH3SNAS by pof
duplicity duplicity for the dns323 by drak0
Firefly: ffp 0.5 Firefly package (with ogg and flac) by Delekhan
lftp: Addons to fonz's fun_plug 0.5 experimental by SweMart
llink llink-2.1.0 for the dns323 by drak0
MySQL: packages for Fonz Funplug 0.5. by forre
nano editor: CH3SNAS:Tutorials/nano by Uli
PHP/MySQL: packages for Fonz Funplug 0.5. by forre
Polipo Web Proxy: Polipo - proxy for funplug 0.5 by rejong
ProFTPD: Addons to fonz's fun_plug 0.5 experimental by SweMart
Python: Python for Fonz funplug 0.5 by forre
smartmontools: SMART monitoring tools on DNS-323?
SSH with denyhosts DenyHosts for Fonz ffp 0.5 by forre
start/usbdisk.sh (Mount external USB disk):
Subversion svnserve: DIY: Turn your NAS into a Subversion Server by mas-tech-talk
sudo: Addons to fonz's fun_plug 0.5 experimental by SweMart
Time Machine, OS X, AppleTalk: HOWTO: Mac OS X (10.5.4) Time Machine and the DNS-323 by TimN
Transmission (Bittorrent):
unrar: http://linux.yes.nu/ffp-0.5/packages/
Build scripts:
funplug on DNS-313: HOWTO: DNS-313 & fun_plug for dummies by Bronek
funplug on Zyxel NSA-220:
Before starting lighttpd, you need to create a config file. To get started, just copy the example config and create the essential directories:
cd /ffp/etc cp examples/lighttpd.conf . cd /mnt/HD_a2 mkdir -p www/logs www/pages sh /ffp/start/lighttpd.sh start
For detail regarding server security see http://forum.dsmg600.info/t793-Request-secure-setup-info-lighttpd.html
This will start the web server on port 8080. Copy your web files to the www/pages directory. Log files are written to www/logs.
To enable PHP, you need to install the php package and use the lighttpd.conf-with-php example config:
funpkg -i /path/to/php-xxxxx.tgz cd /ffp/etc cp examples/lighttpd.conf-with-php lighttpd.conf sh /ffp/start/lighttpd.sh restart
The example config files start lighttpd on port 8080, because the default HTTP port 80 is used by the administration interface (goahead web server). Using a little trick, you can move goahead to port 81 and run lighttpd on port 80: http://forum.dsmg600.info/t246-Change-http-port.html
To setup your lighttpd for port 80, disable the server.port directive in lighttpd.conf, and activate the kickwebs.sh and lighttpd.sh start scripts:
cd /ffp/etc sed -i '/server.port/ s/^/#/' lighttpd.conf cd /ffp/start chmod a+x kickwebs.sh lighttpd.sh
After reboot, lighttpd should run on port 80. To manually activate the changes, run (in quick succession):
cd /ffp/start sh kickwebs.sh start sh lighttpd.sh restart
Note that the above will kill the goahead web server process. It will restart automatically, but this may take a few minutes.
To start openssh, just run:
sh /ffp/start/sshd.sh start
On the first start, it will create the essential key files (may take a minute or two).
SSH sessions will start into the shell configured for the user in /etc/passwd. This defaults to the firmware's busybox shell /bin/sh (enter 5784468 to get a shell prompt).
As root, you can manually change the login shell for user bob:
chsh -s /ffp/bin/bash bob
If you receive
WARNING: Your password has expired. You must change your password now and login again!
messages on login, try if running 'pwconv' (as root) fixes it. See also: http://forum.dsmg600.info/p13142-2008-04-08-12%3A59%3A43.html#p13142
To make your changes permanent, you can store the updated passwd and shadow files to flash memory (TEST YOUR CHANGES BEFORE DOING THIS!!):
store-passwd.sh
Alternatively, you can store your modified passwd and shadow files in /ffp/etc/ and copy them to /etc on every startup. There's not start script included for this, yet.
Before starting ntpd, you need to create a config file. To get started, just copy and edit the example config:
cd /ffp/etc cp examples/ntp.conf . vi ntp.conf
Unless you live in Germany, you should change the four server entries. If in doubt, remove '.de' from each line:
server 0.pool.ntp.org iburst ...
See also: http://www.pool.ntp.org/use.html
On my DNS-323, the clock drift is too large for ntpd and needs additional changes. The start/adjtimex.sh script is included to fix clock drift by adjusting the ticks value.
cd /ffp/start chmod a+x adjtimex.sh ntpd.sh sh adjtimex.sh start sh ntpd.sh start
Check synchronization status with
ntpq -p
ntpd will write a drift file /ffp/etc/ntp.drift (may take a few hours until it's written the first time). If it contains 500 or -500, your clock drift is still too large for ntpd.
The included mediatomb server will search media files in /mnt/HD_a2/home/media. If you have you files in a different location, edit /ffp/start/mediatomb.sh and change the media_dir variable.
Start mediatomb with:
sh /ffp/start/mediatomb.sh start
To make it automatically start after reboot:
cd /ffp/start chmod a+x mediatomb.sh
The mediatomb configuration web interface starts on port 49152: http://bob:49152/ The mediatomb config.xml is in /ffp/var/mediatomb/
Two NFS servers are included:
To start unfs3, run:
sh /ffp/start/unfsd.sh start
To start the kernel-level NFS server:
sh /ffp/start/nfsd.sh start
On the first start, a default exports file is created in /ffp/etc (and a symlink in /etc).
Note that the exports file differs slightly between unfsd and nfsd. Before switching NFS servers, you should remove the exports file.
There's a lot of useful information in the forum and in various blogs. If you find a good guide, please add it to the list.
Backup:
Bittorrent:
Cleanboot (Proper shutdown): cleanboot 1.0 for DNS-323 / CH3SNAS by pof
DynDNS: Utilities for D-link DNS-323 NAS
File System Checks: Modified fun_plug for disk maintenance by skydreamer
FUSE (File System in User Space): Fuse packages for fonz fun_plug by pof
Lighttpd (Web Server): Turning on authentication in lighttpd by shadowandy
Llink (Media Streamer): Compiled & working: llink, media streamer for Syabas based mp's by hps
MediaTomb (UPnP A/V Server) Compiled & working: Mediatomb! by HaydnH
Midnight commander MP (File Manager) Midnight commander by jules
MySQL: MySQL on DNS-323 by petter
Ncurses (Terminal library): http://www.bitmuse.com/funplug/
NFS (Network File System): Full instruction s on how to install NFS on my DNS-323 by moquilok
OpenVPN (Virtual Private Networks): Compiled & Working: OpenVPN by HaydnH
SSH:
Subversion:
timezone.sh: DNS-323 Time Sync with funplug-0.3 timezone.sh
UnRAR: unrar for the DNS-323
USB Storage: Attaching USB Storage to the DNS-323 for Linux Newbies & Dummies by DNS323-Talker