====== fun_plug ====== **fun_plug** is the name of a script that will run after the DNS323 has booted (see [[howto: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): * [[http://www.shadowandy.net/_html/archives/tech/dns323/|shadowandy]] * [[http://bfg100k.blogspot.com/search/label/NAS%20Project|Writings on the wall]] * [[http://techblog357.blogspot.com/search?q=dns-323|Tech Blog 357]] * [[http://ultramookie.com/index.php?s=dns-323|ultramookie]] * [[http://blog.ocliw.com/index.php?submit=Search&s=dns-323|what fools these mortals be!]] * [[http://www.penoycentral.net/index.php?s=dns-323|penoycentral.net]] * [[http://dns323.blogspot.com/|Various Information regarding DNS-323]] * [[http://www.drak0.com/|www.drak0.com - My blog, My place to bitch!]] * [[http://forum.dsmg600.info/index.php|DSM-G600, DNS-323 and TS-I300 Hack Forum]] * [[http://wolf-u.li/tag/ch3snas/|wolf-u.li]] (German) * [[http://christian.samsel.name/index.php?s=dns-323&searchbutton=+Such%21+|(christian.)samsel.name]] (German) * [[http://martinrein.de/wordpress/?s=DNS+323|martinrein.de ]] (German) ====== Version 0.5 ====== ==== Links ==== **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**: * Check out source tree from subversion: svn co svn://inreto.de/svn/dns323/funplug/trunk funplug * See funplug/sources/README.txt for instructions ---------------------- ==== Installation ==== For installation instructions, please follow the link for your device. * **DNS-323, DNS-343 and CH3SNAS** http://www.inreto.de/dns323/fun-plug/0.5/README.txt * **DNS-313** http://forum.dsmg600.info/t2008-HOWTO%3A-DNS-313-fun_plug-dummies-them%29.html * **Zyxel NSA-220** http://forums.nas-central.org/viewtopic.php?f=131&t=191 * **Linksys WRT 350N** http://www.linksysinfo.org/forums/showthread.php?t=57932 ==== Telnet Access ==== 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. ==== Upgrading from 0.3/0.4 ==== 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 ==== Upgrading packages ==== 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 ----------------------- ==== The root user ==== '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. ------------------------------------------- ==== Shells ==== 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: * /ffp/bin/sh - the busybox ash shell (like /bin/sh, but a more recent version, and without unlock code) * /ffp/bin/bash - the popular bourne-again shell (must be installed manually using funpkg, download from [[http://www.inreto.de/dns323/fun-plug/0.5/PACKAGES.html#bash|inreto.de]]) 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 ------------------------------------------- ==== Basic configuration ==== 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: * adjust clock ticks to reduce drift * set your timezone * remove firmware cronjobs * ... /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. ----------------------------------------- ==== Help, Howtos, Guides, Discussions ==== **Cleanboot** (Proper shutdown): [[http://forum.dsmg600.info/t1828-cleanboot-DNS-323-CH3SNAS.html|cleanboot 1.0 for DNS-323 / CH3SNAS by pof]] **duplicity** [[http://www.drak0.com/2008/06/09/dns323-duplicity-encrypted-offsite-backup-bliss/| duplicity for the dns323 by drak0]] **Firefly**: [[http://forum.dsmg600.info/t1897-Firefly-package-%28with-flac%29.html|ffp 0.5 Firefly package (with ogg and flac) by Delekhan]] **lftp**: [[http://forum.dsmg600.info/t1939-Addons-fonz%27s-fun_plug-experimental.html|Addons to fonz's fun_plug 0.5 experimental by SweMart]] **llink** [[http://www.drak0.com/2008/08/07/the-best-llink-so-far-llink-210-for-the-dns323/| llink-2.1.0 for the dns323 by drak0]] **MySQL**: [[http://81.216.140.39/dns-323/mysql_and_php/|packages for Fonz Funplug 0.5. by forre]] **nano editor**: [[http://nas-tweaks.net/CH3SNAS:Tutorials/nano|CH3SNAS:Tutorials/nano by Uli]] **PHP/MySQL**: [[http://81.216.140.39/dns-323/mysql_and_php/|packages for Fonz Funplug 0.5. by forre]] **Polipo Web Proxy**: [[http://forum.dsmg600.info/t2091-Polipo-proxy-funplug.html| Polipo - proxy for funplug 0.5 by rejong]] **ProFTPD**: [[http://forum.dsmg600.info/t1939-Addons-fonz%27s-fun_plug-experimental.html|Addons to fonz's fun_plug 0.5 experimental by SweMart]] **Python**: [[http://forum.dsmg600.info/t2077-DenyHosts-Fonz.html|Python for Fonz funplug 0.5 by forre]] **smartmontools**: [[http://forum.dsmg600.info/t2024-SMART-monitoring-tools-DNS-323%3F.html|SMART monitoring tools on DNS-323?]] **SSH with denyhosts** [[http://forum.dsmg600.info/t2077-DenyHosts-Fonz.html|DenyHosts for Fonz ffp 0.5 by forre]] **start/usbdisk.sh** (Mount external USB disk): * [[http://forum.dsmg600.info/viewtopic.php?pid=12400#p12400|I also had to modify the usbdisk.sh by bq041]] * [[http://forum.dsmg600.info/t1957-script-mounting-devices.html|New script for mounting USB devices by bq041]] * [[http://forum.dsmg600.info/t1963-fonz-addon%3A-Script-mount-drives.html|fonz addon: Script to mount all USB drives by diamond187]] **Subversion svnserve**: [[http://mas-tech-talk.blogspot.com/2008/07/diy-turn-your-nas-into-subversion.html|DIY: Turn your NAS into a Subversion Server by mas-tech-talk]] **sudo**: [[http://forum.dsmg600.info/t1939-Addons-fonz%27s-fun_plug-experimental.html|Addons to fonz's fun_plug 0.5 experimental by SweMart]] **Time Machine, OS X, AppleTalk**: [[http://forum.dsmg600.info/t2598-HOWTO%3A-(10.5.4)-Time-Machine-DNS-323.html|HOWTO: Mac OS X (10.5.4) Time Machine and the DNS-323 by TimN]] **Transmission** (Bittorrent): * [[http://linux.yes.nu/ffp-0.5/packages/]] * [[http://forum.dsmg600.info/t1805-Transmission-Clutch-CH3SNAS-DNS-323.html|Transmission & Clutch on CH3SNAS/DNS-323 by KyleK]] * [[http://forum.dsmg600.info/t2291-%5BREL%5D-Automatic-funplug-0.5.html|Automatic for funplug-0.5 by KyleK]] **unrar**: [[http://linux.yes.nu/ffp-0.5/packages/]] **Build scripts**: * [[http://forum.dsmg600.info/p12883-Today-23%3A05%3A54.html#p12883|Which script builds the current fun_plug distro?]] * [[http://linux.yes.nu/ffp-0.5/|nomego's build scripts and packages]] **funplug on DNS-313**: [[http://forum.dsmg600.info/t2008-HOWTO%3A-DNS-313-fun_plug-dummies-them%29.html|HOWTO: DNS-313 & fun_plug for dummies by Bronek]] **funplug on Zyxel NSA-220**: * [[http://forums.nas-central.org/viewtopic.php?f=131&t=191|FFP on NSA-220 in 8 easy steps. by Mijzelf]] * [[http://forum.dsmg600.info/t2542-fun_plug-ZyXEL-NSA-220..html|fun_plug on ZyXEL NSA-220 by Mijzelf]] --------------------------------------------------- ==== Troubleshooting ==== * [[http://forum.dsmg600.info/t2703-fun_plug-enabling-telnet-access.html|fun_plug 0.5 not enabling telnet access]] ---------------------------- ==== Lighttpd Web Server ==== 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. == PHP == 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 == Port 80 == 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. --------------------------------------------------- ==== OpenSSH Secure Shell Server ==== 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. --------------------------------------------------- ==== NTP Network Time Protocol ==== 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. ------------------------------------- ==== Mediatomb UPnP Media Server ==== 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/ ---------------------------------------- ==== NFS Network File System ==== Two NFS servers are included: * UNFS3 is a user-space NFS server that does not require kernel support * NFS-utils contains required utilities to activate a kernel NFS server (Kernel-level NFS support is available on the CH3SNAS, and not on the DNS-323 unless you install your own kernel). More information can be found in the Linux NFS-HOWTO at http://nfs.sourceforge.net/nfs-howto/ 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. -------------------------------------------- ====== Versions 0.3/0.4 ====== ==== Help, Howtos, Guides, Discussions ==== 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**: * [[http://forum.dsmg600.info/t2125-DNS-323-Rsync-Time-Machine%21.html|DNS-323 Rsync Time Machine! by raid123]] * [[http://forum.dsmg600.info/t1150-Tutorial%3A-Backup-Everything-from-once-night.html|Tutorial: Backup Everything from Vol A to Vol B once a night by Chumby]] * [[http://backupnetclone.sourceforge.net/|BackupNetClone (BNC) by Benjamin L. Brown]] * [[http://www.penoycentral.net/technology/windows-backup-using-dlink-dns-323/|Windows backup using DLINK DNS-323 by penoycentral.net]] **Bittorrent**: * [[http://bfg100k.blogspot.com/2008/01/bittorent-on-dns-323.html|bittorent on the DNS-323]] * [[http://forum.dsmg600.info/t531-torrent-clients-DNS-323.html|torrent clients for DNS-323 by shadowandy]] **Cleanboot** (Proper shutdown): [[http://forum.dsmg600.info/t1828-cleanboot-DNS-323-CH3SNAS.html|cleanboot 1.0 for DNS-323 / CH3SNAS by pof]] **DynDNS**: [[http://81.170.249.146/~hps/dns323/inadyn/|Utilities for D-link DNS-323 NAS]] **File System Checks**: [[http://forum.dsmg600.info/t1708-Modified-fun_plug-disk-maintenance.html|Modified fun_plug for disk maintenance by skydreamer]] **FUSE** (File System in User Space): [[http://forum.dsmg600.info/viewtopic.php?pid=12289|Fuse packages for fonz fun_plug by pof]] **Lighttpd** (Web Server): [[http://www.shadowandy.net/_html/archives/2008/03/turning_on_authentication_in_l.html|Turning on authentication in lighttpd by shadowandy]] **Llink** (Media Streamer): [[http://forum.dsmg600.info/t1507-Compiled-working%3A-llink%2C-media-streamer-Syabas-based-mp%27s.html|Compiled & working: llink, media streamer for Syabas based mp's by hps]] **MediaTomb** (UPnP A/V Server) [[http://forum.dsmg600.info/t1390-Compiled-working%3A-Mediatomb%21.html|Compiled & working: Mediatomb! by HaydnH]] **Midnight commander MP** (File Manager) [[http://forum.dsmg600.info/t823-Midnight-commander.html|Midnight commander by jules]] **MySQL**: [[http://forum.dsmg600.info/t1737-MySQL-DNS-323.html|MySQL on DNS-323 by petter]] **Ncurses** (Terminal library): [[http://www.bitmuse.com/funplug/]] **NFS** (Network File System): [[http://forum.dsmg600.info/t1871-Req%3A-Full-instruction-install-DNS-323.html|Full instruction s on how to install NFS on my DNS-323 by moquilok]] **OpenVPN** (Virtual Private Networks): [[http://forum.dsmg600.info/t1495-Compiled-Working%3A-OpenVPN.html|Compiled & Working: OpenVPN by HaydnH]] **SSH**: * [[http://techblog357.blogspot.com/2007/08/enable-ssh-on-d-link-dns-323-using.html|Enable SSH on the D-Link DNS-323 using funplug-0.3]] * [[http://forum.dsmg600.info/p10503-2008-02-07-16%3A27%3A37.html|ssh connect with public key]] **Subversion**: * [[http://forum.dsmg600.info/t1242-Subversion-1.4.5-fonz-fun_plug-AVAILABLE....html|Subversion 1.4.5 for fonz fun_plug 0.3 NOW AVAILABLE... by petasis]] * [[http://forum.dsmg600.info/t1417-Subversion-1.4.6-fonz-fun_plug-AVAILABLE....html|Subversion 1.4.6 for fonz fun_plug 0.3 NOW AVAILABLE... by petasis]] **timezone.sh**: [[http://techblog357.blogspot.com/2007/08/dns-323-time-sync-with-funplug-03.html|DNS-323 Time Sync with funplug-0.3 timezone.sh]] **UnRAR**: [[http://bfg100k.blogspot.com/2008/03/unrar-for-dns-323.html|unrar for the DNS-323]] **USB Storage**: [[http://forum.dsmg600.info/viewtopic.php?pid=3221#p3221|Attaching USB Storage to the DNS-323 for Linux Newbies & Dummies by DNS323-Talker]]