DLink 323 Ops Manual
This information may be out of date
At the time of writing, the latest version of fun_plug is version 0.5.
All information on this page is taken from the pages referenced in the “References” section at the end.
Much of the information in this document is copied from these websites.
Without the amazing work of these awesome people, the following would not be possible.
Download fun-plug and fun-plug.tar.gz from the fun-plug repository.
Copy both of these files to the root of the Volume_1 share.
Reboot the machine.
Fun-plug will install itself once the machine is booted, this may take a few minutes.
Connect with Telnet
telnet <IP Address goes here>
Setup Root account
Use /etc/shadow and set the root password
Activate the root user
usermod -s /ffp/bin/sh root
Change the home directory for root
mkdir -p /ffp/home/root usermod -d /ffp/home/ root
Check it worked
enter “root” and the password you set previously.
Store passwords in flash instead of RAM.
When modifyin SSH, ALWAYS re-enable telnet incase you lock yourself out of the system.
chmod a+x /ffp/start/sshd.sh sh /ffp/start/sshd.sh start
Check that SSH works
ssh root@[IP ADDRESS]
Login as “root” and use the password you entered previously.
If SSH works, you may disable Telnet, but I advise that you don’t disable Telnet incase you break your SSH config.
chmod -x /ffp/start/telnetd.sh
Use SSH Key authentication
I found editing the sshd_config file caused my SSH daemon to break and locked me out of my system, so I haven’t included that step (the defaults work anyway).
mkdir -p /ffp/home/root/.ssh touch /ffp/home/root/.ssh/authorized_keys chmod 600 /ffp/home/root/.ssh/authorized_keys
Copy in the public file from your keypair.
If you are on a Unix machine, SCP is the best way to do this.
From your machine:
scp /path/to/[my key file] root@[IP ADDRESS]:/ffp/home/root/.ssh/[my key file]
If you are on Windows and don’t have SCP (from PuTTY) then copy it to a location on Volume_1 and then manually move it using SSH (mv <key_file> /ffp/home/root/.ssh/<my key file>)
On the NAS, ensure that the public key has the right permissions
chmod 644 /ffp/home/root/.ssh/[my key file]
Add the key to the list of known keys for the root user
cat [my key file] >> authorized_keys
Create a location for packages to reside.
mkdir -p /ffp/pkg/ cd /ffp/pkg/
Download the full list of packages, this is the recommended method to ensure that packages are updated together.
rsync -av --delete inreto.de::dns323/fun-plug/0.5/packages . rsync -av --delete inreto.de::dns323/fun-plug/0.5/extra-packages . rsync -av --delete ffp.wolf-u.li::ffp/additional .
Update funpkg first
cd /ffp/pkg/ funpkg -u packages/funpkg*.tgz
Update other packages
cd /ffp/pkg funpkg -u packages/*.tgz funpkg -u extra-packages/All/*.tgz funpkg -u additional/*/*.tgz
Ensure you’ve updated any existing packages (optware and fun-plug) before installing anything.
funpkg -i [packagename].tgz
Ensure that you install any dependencies for the package.
funpkg does no dependency checking, so you must find out what each package needs.
funpkg -r [packagename].tgz
Optware packages can be found here.
Optware uses a different package manager.
Install the optware manager
wget http://wolf-u.li/u/238 -O /ffp/start/optware.sh
Make optware executable so we can run it, and so fun-plug will run it at startup
chmod a+x /ffp/start/optware.sh
Install the optware packages
Log out and back in for the $PATH changes to take effect
Update the ipkg list
Previous optware.sh script
The difference between the 233 and 238 scripts are the repositories they use.
If you look at the script you will see comments regarding the DLINK 323 that are commented out in the 233 script.
The solution was to switch the variables to use the DLink-323 repository as shown below.
If you followed the above steps, you do NOT need to do this as the 238 script already has these changes. I have just included it for completeness sake.
# Location of optware package # DNS-323/CH3SNAS: OPTWARE_FEED_NAME="dns323" OPTWARE_FEED=http://ipkg.nslu2-linux.org/feeds/optware/dns323/cross/unstable # DNS-320/DNS-325/DNS-343/CH3MNAS: #OPTWARE_FEED_NAME="cs08q1armel" #OPTWARE_FEED=http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable
Install Optware Packages
Ensure you’ve updated any existing packages (optware and fun-plug) before installing anything.
ipkg automatically installs dependencies (unlike fun-plug) so just install the package you want and it will grab everything it needs for you.
ipkg install [package name]
Remove Optware Package
ipkg remove [package name]
Update Optware Packages
ipkg update ipkg upgrade
User home directories
On reboot, user home directories are reset to /home/ftp (except for the root user).
This is important for a number of users (Gitosis, Gitolite) and perhaps for other functionality (AFP).
Fix this by creating an ffp daemon script.
touch /ffp/start/users.sh chmod +x /ffp/start/users.sh vi /ffp/start/users.sh
Make the script match the following
#!/ffp/bin/bash echo "Changing user home directories" usermod -d [HOME PATH] [USERNAME]
Continue adding more usermod -d statements as you create new system users.
Fix .bashrc being ignored
The default install does not bother to read the .bashrc file so we need to modify this to enable us to set custom paths.
Make a backup of /ffp/etc/profile
cp /ffp/etc/profile .
Edit the file
Change the PATH block to look like this
# Set the default system $PATH: PATH=/ffp/bin:/usr/bin:/bin if [ $(/ffp/bin/id -u) -eq 0 ]; then PATH=/ffp/sbin:/usr/sbin:/sbin:$PATH fi export PATH # MODIFIED: ensure ~/.bashrc is read if [ -r "$HOME/.bashrc" ]; then . $HOME/.bashrc fi
Install dependencies from the ffp repository.
funpkg -i /ffp/pkg/extra-packages/All/perl-5.10-2.tgz ipkg install sudo ipkg install bash
Symlink /ffp/bin/perl to /usr/bin/perl
ln -s /ffp/bin/perl /usr/bin/perl adduser -h /mnt/HD_a2/ffp/home/git -g "git user" -S -D -G git -s /ffp/bin/bash git store-passwd.sh
Add the following line to the user daemon as mentioned above
usermod -d /mnt/HD_a2/ffp/home/git git
Setup gitolite in the /mnt/HD_a2/ffp/home/git directory.
su - git cd git clone git://github.com/sitaramc/gitolite gitolite/src/gl-system-install vi ~/.bashrc
Add the following lines
export PATH=/mnt/HD_a2/fpp/home/git/bin:$PATH logout su - git gl-setup /path/to/your/[my key file].pub
Clone the repository on your local machine
git clone git@[IP ADDRESS]:gitolite-admin
IMPORTANT: These instructions are not complete. Once gitosis is running it does not allow the creation of new repositories. Follow the Gitolite instructions instead.
Ensure you have updated any packages before continuing. See the section “Update Packages” for how to do this.
I recommend using optware for installing this as it will automatically get all the dependencies.
ipkg install gitosis
This will create a gitosis user.
We also need some other packages to setup gitosis
ipkg install sudo ipkg install bash
Set gitosis to use /ffp/bin/bash for its shell
This MUST be /ffp/bin/bash, /bin/bash will not execute the /ffp/etc/profile and setup the user environment and gitosis in /opt/bin will not work.
usermod -s /ffp/bin/bash gitosis
Write the passwd file to flash.
Add the following line to the users daemon script for gitosis as mentioned previously
usermod -d /opt/share/gitosis gitosis
Initialise the git repositories, this requires your public key from earlier to enable the first checkouts of the repository
sudo -H -u gitosis /opt/bin/gitosis-init < /ffp/home/root/.ssh/[my key file].pub
We need to fix non-interactive SSH shells not reading ~/.bashrc
Edit /ffp/etc/ssh/sshd_config and add the following lines:
PermitUserEnvironment yes StrictModes no
Restart sshd or reboot the device
Add the path to the SSH environment
Add the line (note: we can’t use variables here):
Configure SSH on your local machine to use your public key when connecting to your server.
Host gitosis Hostname [IP ADDRESS] User gitosis IdentityFile ~/.ssh/[my key file]
Check out the repository on your machine
git clone gitosis@[IP ADDRESS]:gitosis-admin.git
Daemon control scripts reside in /ffp/start
Any script in here with execute permissions will be automatically run at startup.
This lets to create scripts that run daemons, programs, will add cron jobs and perform other tasks.
This can be very useful as some things (such as cron) are removed at boot.
Start daemon / run script on boot – Add execute access to the start script
chmod a+x /ffp/start/[daemonname].sh
Don’t start daemon / run script on boot – Remove execute access to the start script
chmod a-x /ffp/start/[daemonname].sh
Help! I got locked out of SSH!
Hopefully you still have access to your Volume_1 share.
Even if you have write access, the /ffp directory is not writable remotely, so you can’t fix your SSH config without telnet or ssh access.
If you have telnet access, use that and undo whatever you did. You can try “/ffp/start/sshd.sh restart” and see if there are any errors. If that fails, try rebooting the machine.
Re-install fun-plug as stated in the first section of this article.
Re-installing fun-plug doesn’t destroy any files that aren’t core config. This will reset the SSH config and re-enable SSHD and Telnet.
Re-try SSH, if you are still locked out, re-try telnet.
can’t load library
Running older Funplug versions with new software can lead to some problems finding the correct paths for libraries.
I recently updated Transmission and received the following error:
/opt/bin/transmission-daemon: can't load library 'librt.so.0'
I added this to my /opt/etc/init.d/S99transmission.sh script.
# Update library path LD_LIBRARY_PATH=/lib:/mnt/HD_a2/ffp/opt/optware/lib:/mnt/HD_a2/ffp/lib export LD_LIBRARY_PATH