<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://crancho.com/w/index.php?action=history&amp;feed=atom&amp;title=LinkStation</id>
	<title>LinkStation - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://crancho.com/w/index.php?action=history&amp;feed=atom&amp;title=LinkStation"/>
	<link rel="alternate" type="text/html" href="https://crancho.com/w/index.php?title=LinkStation&amp;action=history"/>
	<updated>2026-05-02T05:45:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://crancho.com/w/index.php?title=LinkStation&amp;diff=1148&amp;oldid=prev</id>
		<title>Ohayden: /* Recovery from Six Blinking Red Lights */</title>
		<link rel="alternate" type="text/html" href="https://crancho.com/w/index.php?title=LinkStation&amp;diff=1148&amp;oldid=prev"/>
		<updated>2010-12-17T23:02:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Recovery from Six Blinking Red Lights&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Buffalo Linkstation (LS2) Mipsel - Derro =&lt;br /&gt;
&lt;br /&gt;
== Recovery from Six Blinking Red Lights ==&lt;br /&gt;
* Tear apart and hooked IDE + power from nix desktop&lt;br /&gt;
* D/L and extract [http://downloads.buffalo.nas-central.org/PlatformSupport/i386/fix_ext2_magic_i386-1.1.tar.gz fix_ext2_magic_i386-1.1.tar.gz] (I stored a copy on my site)&lt;br /&gt;
* Use &amp;quot;fdisk -l&amp;quot; to find he correct drive&lt;br /&gt;
* ./fix_ext2_magic --fix /dev/hdX1&lt;br /&gt;
* Run fsck -f -c /dev/hdX1&lt;br /&gt;
* Unhook and put linkstation back together&lt;br /&gt;
* Done&lt;br /&gt;
&lt;br /&gt;
=Buffalo Linkstation (LS2) Mipsel - Drow =&lt;br /&gt;
&lt;br /&gt;
== Initial Recovery from Brickage ==&lt;br /&gt;
* I re-flashed from a Windows box by connecting LS (LinkStation) directly to the desktops NIC.&lt;br /&gt;
* On the desktop, I set the NIC to a static IP of 192.168.11.100/255.255.255.0, no DNS and no gateway.&lt;br /&gt;
* I downloaded the Freelink from here:&amp;lt;br&amp;gt;&lt;br /&gt;
http://downloads.buffalo.nas-central.org/LS2_MIPSel/Distributions/Freelink/freelink_mipsel-hdhlan-060810.zip&lt;br /&gt;
* I launched the firmware EXE and it found the LS on 192.168.11.150 as expected.&lt;br /&gt;
* Once it was done flashing, I used putty (as I was still on the Windows box) and sshed into 192.168.11.150 with root/freelink.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
              .  \  /&lt;br /&gt;
           __  `-.&amp;#039;&amp;#039;..      This is NOT a guide and is more of a recording of the steps I took!&lt;br /&gt;
         .&amp;#039;  &amp;#039;-- .`.        -------------------------------------------------------------------&lt;br /&gt;
       _|_      / : \        If I were to do over, I would have gparted and installed the 2.6&lt;br /&gt;
     _|___|_                kernel just after recovering the LS from it&amp;#039;s previous brick state.&lt;br /&gt;
   .&amp;#039;       &amp;#039;.&lt;br /&gt;
  /        &amp;#039;  \&lt;br /&gt;
 |          |  |&lt;br /&gt;
 |          |  |&lt;br /&gt;
  \        /  /&lt;br /&gt;
   &amp;#039;.    &amp;#039;  .&amp;#039;&lt;br /&gt;
     &amp;#039;-----&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tweaking the LS ==&lt;br /&gt;
* Then I ran the following shell commands:&lt;br /&gt;
* Added a nameserver:&lt;br /&gt;
  vi /etc/resolv.conf&lt;br /&gt;
* Added:&lt;br /&gt;
  nameserver 192.168.0.5&lt;br /&gt;
* Updated network to my ip/subnet:&lt;br /&gt;
  vi /etc/network/interfaces&lt;br /&gt;
* Changed eth0 to:&lt;br /&gt;
          auto eth0&lt;br /&gt;
          iface eth0 inet static&lt;br /&gt;
          address 192.168.0.150&lt;br /&gt;
          netmask 255.255.255.0&lt;br /&gt;
          broadcast 192.168.0.255&lt;br /&gt;
          gateway 192.168.0.5&lt;br /&gt;
* I then shutdown the LS and moved it from being plugged directly into the Windows box, to the router.&lt;br /&gt;
  halt&lt;br /&gt;
* Powered it back on once I was connected to the right network and relogged in via ssh.&lt;br /&gt;
* Fixed sources so we don&amp;#039;t download lenny (or whatever is the latest stable)&lt;br /&gt;
  vi /etc/apt/sources.list&lt;br /&gt;
* Changed stable to etch with:&lt;br /&gt;
  :%s/stable/etch/gc&lt;br /&gt;
&amp;lt;strike&amp;gt;* Moved data to free up limited space on the small partition:&lt;br /&gt;
  mv /home /mnt/hda/&lt;br /&gt;
  mv /usr /mnt/hda/&lt;br /&gt;
  mkdir home&lt;br /&gt;
  mkdir usr&lt;br /&gt;
  chown root:staff home/&lt;br /&gt;
* Updated fstab to mount new entries&lt;br /&gt;
  vi /etc/fstab &lt;br /&gt;
* Added:&lt;br /&gt;
  /mnt/hda/home	/home		none	bind&lt;br /&gt;
  /mnt/hda/usr	/usr		none	bind&lt;br /&gt;
* Forced fstab to mount new entries&lt;br /&gt;
  mount -a&amp;lt;/strike&amp;gt;&lt;br /&gt;
* Updated packages:&lt;br /&gt;
   apt-get update&lt;br /&gt;
* Upgrade existing programs (always a good idea to simulate it first via apt-get upgrade -s):&lt;br /&gt;
   apt-get upgrade&lt;br /&gt;
* Get my favorite minimalist command line editor, vim:&lt;br /&gt;
   apt-get install vim&lt;br /&gt;
* Fix the timezone:&lt;br /&gt;
  tzconfig  (n, 2, Los_Angeles)&lt;br /&gt;
  date -s &amp;quot;20 Mar 2009 15:00:00&amp;quot;&lt;br /&gt;
* Install ntpdate&lt;br /&gt;
  apt-get install ntpdate&lt;br /&gt;
* Add a cron job to manage the time sync:&lt;br /&gt;
  vim /etc/cron.daily/setdatetime&lt;br /&gt;
* Add the following, save, and exited:&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  /usr/sbin/ntpdate pool.ntp.org&lt;br /&gt;
* Mark new cron job and executable:&lt;br /&gt;
  chmod +x /etc/cron.daily/setdatetime&lt;br /&gt;
* Less is more, therefore we need it:&lt;br /&gt;
  apt-get install less&lt;br /&gt;
* I noticed the primary partition was only about 300ish MB, so I decided I&amp;#039;d better resize the partitions now before I invest too much time.  I used a GParted live cd to shave off 17GB from the last partition and gave it to the primary.&lt;br /&gt;
* Brought a few packages from being kept back:&lt;br /&gt;
  apt-get install adduser apt apt-get bash cron gcc install passwd ssh sysvinit&lt;br /&gt;
* Added samba&lt;br /&gt;
  apt-get install samba smbfs&lt;br /&gt;
* Added screen&lt;br /&gt;
  apt-get install screen&lt;br /&gt;
* Added thttpd for movies.cgi script&lt;br /&gt;
  apt-get install thttpd&lt;br /&gt;
* Added psmisc (for killall)&lt;br /&gt;
  apt-get install psmisc&lt;br /&gt;
* Upgrade existing programs again:&lt;br /&gt;
   apt-get upgrade&lt;br /&gt;
* Changed the &amp;quot;Banner&amp;quot; to /etc/banner in /etc/ssh/sshd_config&lt;br /&gt;
* Added a /etc/banner &lt;br /&gt;
* Edited /etc/motd&lt;br /&gt;
* Turn off file checks as it will cause a problem with the watchdog and can brick the box:&lt;br /&gt;
  tune2fs -c 0 -i 0 /dev/hda1&lt;br /&gt;
  tune2fs -c 0 -i 0 /dev/hda3&lt;br /&gt;
&lt;br /&gt;
== 2.6 Kernel / iptables / knockd ==&lt;br /&gt;
Apparently the 2.4 kernel with FreeLink / Debian doesn&amp;#039;t support iptables.  Here&amp;#039;s my pieced together guide on updating to the 2.6 kernel:&lt;br /&gt;
* Create proper directories&lt;br /&gt;
  cd /mnt/hda/&lt;br /&gt;
  mkdir share&lt;br /&gt;
  cd share&lt;br /&gt;
* Download u-boot:&lt;br /&gt;
  wget http://downloads.buffalo.nas-central.org/LS2_MIPSel/Bootloader/Uboot/Precompiled/u-boot-1.1.4-list-v2-1.0.1.tar.gz&lt;br /&gt;
  tar zxfv ./u-boot-1.1.4-list-v2-1.0.1.tar.gz &lt;br /&gt;
  mkdir u-boot&lt;br /&gt;
  cp u-boot-v2-mips.flash.bin u-boot/&lt;br /&gt;
* Copy both the kernels to /boot (vmlinux-2.6.22.gz and vmlinuz)&lt;br /&gt;
  cp vmlinu* /boot/&lt;br /&gt;
* Put the LS addy back to 192.168.11.150&lt;br /&gt;
  vim /etc/network/interfaces&lt;br /&gt;
* Shutdown the LS&lt;br /&gt;
  halt&lt;br /&gt;
* Plug the LS directly into my laptop running Debian&lt;br /&gt;
* Changed my laptop&amp;#039;s addy to 192.168.11.149&lt;br /&gt;
* Restart my laptop&amp;#039;s network&lt;br /&gt;
  /etc/init.d/networking restart&lt;br /&gt;
* Start up netcat on my lappie&lt;br /&gt;
  nc -uvvp 6666 192.168.11.150 6666&lt;br /&gt;
* Turn on the LS in &amp;quot;Christmas Tree Mode&amp;quot; aka all the lights flashing.  Hold down reset and press power to boot up, as soon as you see the lights flashing let go.&lt;br /&gt;
* Login into LS and flash u-boot&lt;br /&gt;
  ssh 192.168.11.150&lt;br /&gt;
  cd /mnt/hda/share&lt;br /&gt;
  ./u-boot-load.sh&lt;br /&gt;
  run upgrade&lt;br /&gt;
* Power off the LS by holding the power button&lt;br /&gt;
* Watch the netcat from the lappie and we should see output from the LS&lt;br /&gt;
* Press &amp;#039;s&amp;#039; as it says to stop&lt;br /&gt;
* Set the environment variable to the new kernel&lt;br /&gt;
  setenv hdfile boot/vmlinux-2.6.22.gz&lt;br /&gt;
  saveenv&lt;br /&gt;
  reset&lt;br /&gt;
* The LS will now reboot with the 2.6 kernel&lt;br /&gt;
* Set the LS back to the right IP and the lappie as well, then plug back in the right network cables.&lt;br /&gt;
* Get the new module tools for the 2.6 kernel (bakup old ones just in case)&lt;br /&gt;
  cd /mnt/hda/share/&lt;br /&gt;
  mkdir x&lt;br /&gt;
  cd x&lt;br /&gt;
  wget http://downloads.buffalo.nas-central.org/LS2_MIPSel/Kernel/Kernels/Uboot/module-init-tools-3.3-pre1.tar.gz&lt;br /&gt;
  tar zxvf module-init-tools-3.3-pre1.tar.gz &lt;br /&gt;
  ls ./sbin/     &amp;lt;-- SEE WHAT&amp;#039;S GOING TO BE OVERWRITTEN&lt;br /&gt;
  mkdir bak&lt;br /&gt;
  cd bak&lt;br /&gt;
  cp /sbin/depmod ./&lt;br /&gt;
  cp /sbin/insmod ./&lt;br /&gt;
  cp /sbin/lsmod ./&lt;br /&gt;
  cp /sbin/modinfo ./&lt;br /&gt;
  cp /sbin/modprobe ./&lt;br /&gt;
  cp /sbin/rmmod ./&lt;br /&gt;
  cd ..&lt;br /&gt;
  tar -C / -zxvf module-init-tools-3.3-pre1.tar.gz &lt;br /&gt;
* Get the 2.6 modules&lt;br /&gt;
  cd /mnt/hda/share/&lt;br /&gt;
  mkdir y&lt;br /&gt;
  cd y&lt;br /&gt;
  wget http://downloads.buffalo.nas-central.org/LS2_MIPSel/Kernel/Modules/kernel-modules-2.6.22.ls2.tar.gz&lt;br /&gt;
  tar -C / -zxvf kernel-modules-2.6.22.ls2.tar.gz&lt;br /&gt;
* Install knockd&lt;br /&gt;
  apt-get install knockd&lt;br /&gt;
* Edit knockd.conf (see knockd.conf below)&lt;br /&gt;
  vim /etc/knockd.conf&lt;br /&gt;
* Enable knockd, set START_KNOCKD to 1:&lt;br /&gt;
  vim /etc/default/knockd&lt;br /&gt;
* Create /sbin/flc/allowssh.sh  (see below for contents)&lt;br /&gt;
  mkdir /sbin/flc/&lt;br /&gt;
  vim /sbin/flc/allowssh.sh&lt;br /&gt;
  chmod +x /sbin/flc/allowssh.sh&lt;br /&gt;
* Create /sbin/flc/blockssh.sh  (see below for contents)&lt;br /&gt;
  vim /sbin/flc/blockssh.sh&lt;br /&gt;
  chmod +x /sbin/flc/blockssh.sh&lt;br /&gt;
* Add blockssh.sh to the rc.local (see below for addtion)&lt;br /&gt;
  vim /etc/rc.local&lt;br /&gt;
* Moved /dev/hda3 from /mnt/hda/ to /share&lt;br /&gt;
  mkdir /share&lt;br /&gt;
  umount /mnt/hda&lt;br /&gt;
  vim /etc/fstab&lt;br /&gt;
  :%s/mnt\/hda/share/gc&lt;br /&gt;
  :wq&lt;br /&gt;
  mount -a&lt;br /&gt;
&lt;br /&gt;
== JailKit ==&lt;br /&gt;
I use JailKit to lock down the backups as I use an identity file to script the backup process.&lt;br /&gt;
* Install python for JailKit&lt;br /&gt;
  apt-get install python&lt;br /&gt;
* Download latest JailKit and then install via:&lt;br /&gt;
  mkdir /share/flc/jailkit&lt;br /&gt;
  cd /share/flc/jailkit&lt;br /&gt;
  wget http://olivier.sessink.nl/jailkit/jailkit-2.5.tar.gz&lt;br /&gt;
  tar zxfv jailkit-2.5.tar.gz&lt;br /&gt;
  cd jailkit-2.5&lt;br /&gt;
  ./configure&lt;br /&gt;
  make&lt;br /&gt;
  make install&lt;br /&gt;
* Install the daemon:&lt;br /&gt;
  cp extra/jailkit /etc/init.d/jailkit&lt;br /&gt;
  chmod a+x /etc/init.d/jailkit&lt;br /&gt;
  update-rc.d jailkit defaults&lt;br /&gt;
* Update the configs, see below and then reboot:&lt;br /&gt;
  reboot&lt;br /&gt;
* Added rsync (not from Debian repository since it was older and had a bug with settings times on a directory)&lt;br /&gt;
  mkdir /share/flc/rsync&lt;br /&gt;
  cd /share/flc/rsync&lt;br /&gt;
  wget http://www.samba.org/ftp/rsync/src/rsync-3.0.5.tar.gz&lt;br /&gt;
  tar zxvf rsync-3.0.5.tar.gz &lt;br /&gt;
  cd rsync-3.0.5&lt;br /&gt;
  ./configure&lt;br /&gt;
  make&lt;br /&gt;
  make install&lt;br /&gt;
  ln -s /usr/local/bin/rsync /usr/bin/&lt;br /&gt;
* Create jail and add a jailed user:  &lt;br /&gt;
  mkdir /share/jail&lt;br /&gt;
  chown root:root /share/jail&lt;br /&gt;
  chmod 0755 /share/jail&lt;br /&gt;
  jk_init -j /share/jail jk_lsh&lt;br /&gt;
  jk_init -j /share/jail rsync&lt;br /&gt;
  jk_init -j /share/jail scp&lt;br /&gt;
  adduser &amp;lt;USERNAME&amp;gt;&lt;br /&gt;
  jk_jailuser -m -j /share/jail &amp;lt;USERNAME&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Finishing Touches ==&lt;br /&gt;
* Add hdparm and smartctl as required by the /sbin/flc/silentfan.sh&lt;br /&gt;
  apt-get install hdparm smartmontools&lt;br /&gt;
* Add arping as required by the /sbin/flc/checkarp.sh, nmap is for follow up scans from arping&lt;br /&gt;
  apt-get install arping nmap&lt;br /&gt;
* Added the following scripts: (see below) (setip.sh is not a public script and will not be documented here)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/sbin/flc/arpcheck.sh&lt;br /&gt;
/sbin/flc/backup_check.sh&lt;br /&gt;
/sbin/flc/backup_rotate.sh&lt;br /&gt;
/sbin/flc/email.good&lt;br /&gt;
/sbin/flc/email.bad&lt;br /&gt;
/sbin/flc/setip.sh&lt;br /&gt;
/sbin/flc/silentfan.sh&lt;br /&gt;
/sbin/flc/silentfan_cron.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Set the hostname&lt;br /&gt;
  vim /etc/hostname&lt;br /&gt;
  vim /etc/hosts&lt;br /&gt;
* Remove Exim4 and install ssmtp, which is smaller and cleaner for what I&amp;#039;m trying to do:&lt;br /&gt;
  apt-get remove --purge exim4 exim4-base exim4-config exim4-daemon-light&lt;br /&gt;
  apt-get install ssmtp&lt;br /&gt;
* Configured ssmtp (see below):&lt;br /&gt;
  vim /etc/ssmtp/ssmtp.conf&lt;br /&gt;
* Added scripts to /etc/crontab as:&lt;br /&gt;
  */5  *   * * * root  /sbin/flc/setip.sh&lt;br /&gt;
  */30 *   * * * root  /sbin/flc/silentfan_cron.sh&lt;br /&gt;
  */30 *   * * * root  /sbin/flc/backup_check.sh&lt;br /&gt;
  01   1   * * * root  /sbin/flc/backup_rotate.sh&lt;br /&gt;
* Added a blank MAILTO in crontab to avoid emails from cron:&lt;br /&gt;
  MAILTO=&amp;quot;&amp;quot;&lt;br /&gt;
* Fix the power button / avr (Power button wouldn&amp;#039;t power down the LS after holding it for 3 seconds like it used to do)&lt;br /&gt;
  vim /etc/default/avr_evtd&lt;br /&gt;
  :%s/#DEVICE/DEVICE/gc&lt;br /&gt;
  :%s/ttyS1/ttyS0/gc&lt;br /&gt;
&lt;br /&gt;
== Configuration Files and Scripts ==&lt;br /&gt;
===/etc/knockd.conf===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; Don&amp;#039;t worry, I didn&amp;#039;t leave the ports as defined here!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[options]&lt;br /&gt;
        logfile = /var/log/knockd.log&lt;br /&gt;
&lt;br /&gt;
[openSSHALL]&lt;br /&gt;
        sequence    = 7000,8000,9000&lt;br /&gt;
        seq_timeout = 5&lt;br /&gt;
        command     = /sbin/flc/allowssh.sh&lt;br /&gt;
        tcpflags    = syn&lt;br /&gt;
&lt;br /&gt;
[openSSH]&lt;br /&gt;
        sequence    = 9000,8000,7000&lt;br /&gt;
        seq_timeout = 5&lt;br /&gt;
        command     = /sbin/flc/allowssh.sh %IP%&lt;br /&gt;
        tcpflags    = syn&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/etc/rc.local===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This will block ssh for non established connections (use knockd to open)&lt;br /&gt;
/sbin/flc/blockssh.sh &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/etc/jailkit/jk_check.ini===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; This is only the changes&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[/share/jail]&lt;br /&gt;
#FLC:ignorepathoncompare = /home/testchroot/home, /home/testchroot/etc&lt;br /&gt;
ignorepathoncompare = /share/jail/home, /share/jail/etc, /share/jail/tmp/&lt;br /&gt;
&lt;br /&gt;
#FLC:ignorewritableforgroup = /home/testchroot/home&lt;br /&gt;
#FLC:ignorewritableforothers = /home/testchroot/home/tmp&lt;br /&gt;
ignorewritableforgroup = /share/jail/home, /share/jail/tmp&lt;br /&gt;
ignorewritableforothers = /share/jail/home, /share/jail/tmp&lt;br /&gt;
&lt;br /&gt;
#FLC:ignoresetuidexecuteforuser = /home/testchroot/usr/bin/smbmnt, /home/testchroot/usr/bin/smbumount&lt;br /&gt;
#FLC:ignoresetuidexecuteforgroup = /home/testchroot/usr/bin/smbmnt, /home/testchroot/usr/bin/smbumount&lt;br /&gt;
#FLC:ignoresetuidexecuteforothers =&lt;br /&gt;
ignoresetuidexecuteforuser = /share/jail/home&lt;br /&gt;
ignoresetuidexecuteforgroup = /share/jail/home&lt;br /&gt;
ignoresetuidexecuteforothers = /share/jail/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===/etc/jailkit/jk_chrootsh.ini===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; This is only the changes&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#[BOM] FLC&lt;br /&gt;
[DEFAULT]&lt;br /&gt;
env = PATH, PS1&lt;br /&gt;
#[EOM] FLC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/etc/jailkit/jk_init.ini===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; I didn&amp;#039;t change anything in this file&lt;br /&gt;
----&lt;br /&gt;
===/etc/jailkit/jk_lsh.ini===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; This is only the changes&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# [BOM] FLC&lt;br /&gt;
[DEFAULT]&lt;br /&gt;
paths = /usr/bin, /bin&lt;br /&gt;
executables = /usr/bin/rsync&lt;br /&gt;
# [EOM] FLC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/etc/jailkit/jk_socketd.ini===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; This is only the changes&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# [BOM] FLC&lt;br /&gt;
[/share/jail/dev/log]&lt;br /&gt;
base=512&lt;br /&gt;
peek=2048&lt;br /&gt;
interval=10&lt;br /&gt;
# [EOM] FLC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/etc/jailkit/jk_update.ini===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[/share/jail]&lt;br /&gt;
#FLC:skips = /usr/bin/myscript&lt;br /&gt;
hardlinks = 0&lt;br /&gt;
directories = /usr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/etc/samba/smb.conf===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; Only the options that were changed are documented here&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[global]&lt;br /&gt;
# Change this to the workgroup/NT-domain name your Samba server will part of&lt;br /&gt;
   workgroup = workgroup&lt;br /&gt;
&lt;br /&gt;
# server string is the equivalent of the NT Description field&lt;br /&gt;
   server string = %h server&lt;br /&gt;
&lt;br /&gt;
# This will prevent nmbd to search for NetBIOS names through DNS.&lt;br /&gt;
   dns proxy = no&lt;br /&gt;
&lt;br /&gt;
# This tells Samba to use a separate log file for each machine&lt;br /&gt;
# that connects&lt;br /&gt;
   log file = /var/log/samba/log.%m&lt;br /&gt;
&lt;br /&gt;
# Put a capping on the size of the log files (in Kb).&lt;br /&gt;
   max log size = 1000&lt;br /&gt;
&lt;br /&gt;
# We want Samba to log a minimum amount of information to syslog. Everything&lt;br /&gt;
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log&lt;br /&gt;
# through syslog you should set the following parameter to something higher.&lt;br /&gt;
   syslog = 0&lt;br /&gt;
&lt;br /&gt;
# Do something sensible when Samba crashes: mail the admin a backtrace&lt;br /&gt;
   panic action = /usr/share/samba/panic-action %d&lt;br /&gt;
&lt;br /&gt;
# You may wish to use password encryption.  See the section on&lt;br /&gt;
# &amp;#039;encrypt passwords&amp;#039; in the smb.conf(5) manpage before enabling.&lt;br /&gt;
   encrypt passwords = true&lt;br /&gt;
&lt;br /&gt;
# If you are using encrypted passwords, Samba will need to know what&lt;br /&gt;
# password database type you are using.  &lt;br /&gt;
   passdb backend = tdbsam&lt;br /&gt;
&lt;br /&gt;
   obey pam restrictions = yes&lt;br /&gt;
&lt;br /&gt;
   invalid users = root&lt;br /&gt;
&lt;br /&gt;
# For Unix password sync to work on a Debian GNU/Linux system, the following&lt;br /&gt;
# parameters must be set (thanks to Ian Kahan &amp;lt;&amp;lt;kahan@informatik.tu-muenchen.de&amp;gt;&lt;br /&gt;
# sending the correct chat script for the passwd program in Debian Sarge).&lt;br /&gt;
   passwd program = /usr/bin/passwd %u&lt;br /&gt;
   passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword&lt;br /&gt;
&lt;br /&gt;
# Most people will find that this option gives better performance.&lt;br /&gt;
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html&lt;br /&gt;
# for details&lt;br /&gt;
# You may want to add the following on a Linux system:&lt;br /&gt;
#         SO_RCVBUF=8192 SO_SNDBUF=8192&lt;br /&gt;
   socket options = TCP_NODELAY&lt;br /&gt;
&lt;br /&gt;
[movies]&lt;br /&gt;
   comment = Movies&lt;br /&gt;
   writable = no&lt;br /&gt;
   locking = no&lt;br /&gt;
   path = /share/movies&lt;br /&gt;
   public = yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/etc/ssmtp/ssmtp.conf===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
# Config file for sSMTP sendmail&lt;br /&gt;
#&lt;br /&gt;
# The person who gets all mail for userids &amp;lt; 1000&lt;br /&gt;
# Make this empty to disable rewriting.&lt;br /&gt;
root=root&lt;br /&gt;
&lt;br /&gt;
# The place where the mail goes. The actual machine name is required no &lt;br /&gt;
# MX records are consulted. Commonly mailhosts are named mail.domain.com&lt;br /&gt;
mailhub=smtp.windstream.net&lt;br /&gt;
AuthUser=*****HIDDEN*****&lt;br /&gt;
AuthPass=*****HIDDEN*****&lt;br /&gt;
&lt;br /&gt;
# Where will the mail seem to come from? &lt;br /&gt;
# FLC - Must exists&lt;br /&gt;
rewriteDomain=crancho.com&lt;br /&gt;
&lt;br /&gt;
# The full hostname&lt;br /&gt;
hostname=drow.crancho.com&lt;br /&gt;
&lt;br /&gt;
# Are users allowed to set their own From: address?&lt;br /&gt;
# YES - Allow the user to specify their own From: address&lt;br /&gt;
# NO - Use the system generated From: address&lt;br /&gt;
FromLineOverride=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/etc/thttpd/thttpd.conf===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#------------------------------------------------------------------------------#&lt;br /&gt;
#                           thttpd version 2.23beta1                           #&lt;br /&gt;
#                           Main configuration file                            #&lt;br /&gt;
#------------------------------------------------------------------------------#&lt;br /&gt;
#------------------------------------------------------------------------------#&lt;br /&gt;
# Port: portnum&lt;br /&gt;
# Sets the port number which will be listened by thttpd.&lt;br /&gt;
# Default: 80&lt;br /&gt;
#&lt;br /&gt;
port=80&lt;br /&gt;
&lt;br /&gt;
# chroot/nochroot&lt;br /&gt;
# Sets whether thttpd will chroot after starting.&lt;br /&gt;
# Default: nochroot&lt;br /&gt;
nochroot&lt;br /&gt;
&lt;br /&gt;
# user: userid&lt;br /&gt;
# Specified which user to switch after intialiazation when started as root.&lt;br /&gt;
# Default: www-data&lt;br /&gt;
##FLC - I need ohayden for moving movies.cgi&lt;br /&gt;
##user=www-data&lt;br /&gt;
user=ohayden&lt;br /&gt;
&lt;br /&gt;
# host: hostname&lt;br /&gt;
# Specifies a hostname to bind to.&lt;br /&gt;
# Default: Bind to all supported hostnames on the local machine.&lt;br /&gt;
# host=grugler&lt;br /&gt;
&lt;br /&gt;
# Logfile: logfile path&lt;br /&gt;
# Specifies a file for logging.&lt;br /&gt;
# Default: Log via syslog()&lt;br /&gt;
logfile=/var/log/thttpd.log&lt;br /&gt;
&lt;br /&gt;
# throttles: file&lt;br /&gt;
# Specifies a file of throttle settings.&lt;br /&gt;
# Default: /etc/thttpd/throttle.conf&lt;br /&gt;
throttles=/etc/thttpd/throttle.conf&lt;br /&gt;
&lt;br /&gt;
# urlpat: pattern&lt;br /&gt;
# Specifies which URL can only be only be accessed from the local server.&lt;br /&gt;
# Default: None&lt;br /&gt;
# urlpat=*.mpeg|*.mp3|*.wav|*.gz|*.jpg|*.gif&lt;br /&gt;
&lt;br /&gt;
# dir: directory&lt;br /&gt;
# Specifies a directory to chdir() to after thttpd starts.&lt;br /&gt;
# This directory will most likely be the directory you will be serving your&lt;br /&gt;
# clients from.&lt;br /&gt;
# Default: `cwd`&lt;br /&gt;
dir=/var/www&lt;br /&gt;
&lt;br /&gt;
# cgipat: pattern&lt;br /&gt;
# Specifies which URL may contain executable CGI files.&lt;br /&gt;
# Default: None&lt;br /&gt;
cgipat=/cgi-bin/**&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/sbin/flc/arpcheck.sh===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# checkarp.sh by Frank Cardoza - Finds all devices responding to arp&lt;br /&gt;
#########################################################################&lt;br /&gt;
&lt;br /&gt;
tIP=&amp;quot;192.168.1.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Checking $tIP.x&amp;quot; &amp;gt; /tmp/lastcheckarp.txt&lt;br /&gt;
&lt;br /&gt;
for tIPX in $(seq 1 254)&lt;br /&gt;
do&lt;br /&gt;
   tResult=`arping $tIP$tIPX -i eth0 -c 1`&lt;br /&gt;
   tCount=`echo $tResult | grep &amp;quot;0 packets received&amp;quot; | wc -l`&lt;br /&gt;
   if [ $tCount -eq 0 ]; then&lt;br /&gt;
      tMAC=`echo $tResult | awk &amp;#039;{ print $6 }&amp;#039;`&lt;br /&gt;
      echo &amp;quot;$tIP$tIPX - $tMAC&amp;quot;&lt;br /&gt;
      echo &amp;quot;$tIP$tIPX - $tMAC&amp;quot; &amp;gt;&amp;gt; /tmp/lastcheckarp.txt&lt;br /&gt;
   fi&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===/sbin/flc/allowssh.sh===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script is called by knockd&lt;br /&gt;
#########################################################################&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;br /&gt;
  echo Allowing SSH for $1... &amp;gt;&amp;gt; /tmp/ssh.log&lt;br /&gt;
  /sbin/iptables -I INPUT -s $1 --protocol tcp --dport 22 --jump ACCEPT&lt;br /&gt;
  sleep 30&lt;br /&gt;
  echo Closing SSH for $1... &amp;gt;&amp;gt; /tmp/ssh.log&lt;br /&gt;
  /sbin/iptables -D INPUT -s $1 --protocol tcp --dport 22 --jump ACCEPT&lt;br /&gt;
else&lt;br /&gt;
  echo Allowing SSH for ALL... &amp;gt;&amp;gt; /tmp/ssh.log&lt;br /&gt;
  /sbin/iptables -I INPUT --protocol tcp --dport 22 --jump ACCEPT&lt;br /&gt;
  sleep 30&lt;br /&gt;
  echo Closing SSH for ALL... &amp;gt;&amp;gt; /tmp/ssh.log&lt;br /&gt;
  /sbin/iptables -D INPUT --protocol tcp --dport 22 --jump ACCEPT&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===/sbin/flc/backup_check.sh===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
###############################################################################&lt;br /&gt;
# BACKUP_CHECK.SH BY FRANK CARDOZA - 02.11.2006&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
tDirHome=&amp;quot;/share/jail/home/&amp;quot;&lt;br /&gt;
tEmailGood=`cat /sbin/flc/email.good`&lt;br /&gt;
tEmailBad=`cat /sbin/flc/email.bad`&lt;br /&gt;
&lt;br /&gt;
# LOOP THROUGH ALL THE HOME DIRECTORIES&lt;br /&gt;
for tDirUser in `ls $tDirHome`&lt;br /&gt;
do&lt;br /&gt;
   # IF THE HOME DIRECTORY HAS A &amp;quot;backup&amp;quot; DIRECTORY THEN CHECK FOR FLAG FILES&lt;br /&gt;
   if [ -d $tDirHome$tDirUser/backup ]; then&lt;br /&gt;
      # IF WE SEE A .began FLAG FILE DO SOME PROCESSING...&lt;br /&gt;
      if [ -f $tDirHome$tDirUser/.began ]; then&lt;br /&gt;
         # SET THE DEFAULT CONFIGURATION&lt;br /&gt;
         if [ -f $tDirHome$tDirUser/.config ]; then&lt;br /&gt;
            # 1ST LINE IS EMAIL ADDRESS&lt;br /&gt;
            tEmailAddy=`awk &amp;#039;NR == 1&amp;#039; $tDirHome$tDirUser/.config`&lt;br /&gt;
            # 2ND LINE IS NAME FOR THE EMAIL GREETING&lt;br /&gt;
            tEmailName=`awk &amp;#039;NR == 2&amp;#039; $tDirHome$tDirUser/.config`&lt;br /&gt;
         else&lt;br /&gt;
            tEmailAddy=&amp;quot;*****EMAILL ADRESS HIDDEN TO AVOID SPAM*****&amp;quot;&lt;br /&gt;
            tEmailName=&amp;quot;Frank Cardoza&amp;quot;&lt;br /&gt;
         fi&lt;br /&gt;
         # CHECK IF WE HAVE THE .ended FLAG FILE, IF SO THEN ALL IS GOOD&lt;br /&gt;
         if [ -f $tDirHome$tDirUser/.ended ]; then&lt;br /&gt;
            # GET THE DYNAMIC INFORMATION FOR THE EMAIL&lt;br /&gt;
            tSize=`du -sb $tDirHome$tDirUser/backup/ | awk &amp;#039;{print $1}&amp;#039;`&lt;br /&gt;
            tDate1=`cat $tDirHome$tDirUser/.began | awk &amp;#039;{print $1&amp;quot; &amp;quot;$2&amp;quot; &amp;quot;$3}&amp;#039;`&lt;br /&gt;
            tDate2=`cat $tDirHome$tDirUser/.ended | awk &amp;#039;{print $1&amp;quot; &amp;quot;$2&amp;quot; &amp;quot;$3}&amp;#039;`&lt;br /&gt;
            # SUBSITUTE IN THE DYNAMIC INFORMATION&lt;br /&gt;
            tEmailBody=$tEmailGood&lt;br /&gt;
            tEmailBody=${tEmailBody/&amp;lt;&amp;lt;USER&amp;gt;&amp;gt;/$tEmailName}&lt;br /&gt;
            tEmailBody=${tEmailBody/&amp;lt;&amp;lt;DT1&amp;gt;&amp;gt;/$tDate1}&lt;br /&gt;
            tEmailBody=${tEmailBody/&amp;lt;&amp;lt;DT2&amp;gt;&amp;gt;/$tDate2}&lt;br /&gt;
            tEmailBody=${tEmailBody/&amp;lt;&amp;lt;SIZE&amp;gt;&amp;gt;/$tSize}&lt;br /&gt;
            # SEND THE MAIL&lt;br /&gt;
            echo -en &amp;quot;From: Drow &amp;lt;*****EMAILL ADRESS HIDDEN TO AVOID SPAM*****&amp;gt;\nSubject: Backup\n\n&amp;quot;&lt;br /&gt;
            echo -e $tEmailBody &amp;gt;&amp;gt; email.temp&lt;br /&gt;
            cat email.temp | ssmtp $tEmailAddy&lt;br /&gt;
            # DELETE ALL THE FLAG FILES&lt;br /&gt;
            if [ -f $tDirHome$tDirUser/.began ]; then rm -f $tDirHome$tDirUser/.&lt;br /&gt;
            if [ -f $tDirHome$tDirUser/.ended ]; then rm -f $tDirHome$tDirUser/.&lt;br /&gt;
            if [ -f $tDirHome$tDirUser/.1.flc ]; then rm -f $tDirHome$tDirUser/.&lt;br /&gt;
            if [ -f $tDirHome$tDirUser/.2.flc ]; then rm -f $tDirHome$tDirUser/.&lt;br /&gt;
            # CREATE FLAG FILE FOR ROTATION SCRIPT&lt;br /&gt;
            touch $tDirHome$tDirUser/.rotate&lt;br /&gt;
         else&lt;br /&gt;
            # IF WE SEE A .began AND NOT A .ended THEN THERE &amp;quot;MIGHT&amp;quot; BE A PROBLE&lt;br /&gt;
            tCheck=`ps aux | grep $tDirUser | grep rsync | grep -v grep`&lt;br /&gt;
            tCheckRunning=${#tCheck}&lt;br /&gt;
            # IF NOT RUNNING RSYNC FOR THE USER THEN, WE NEED TO CHECK FLAGS&lt;br /&gt;
            if [ $tCheckRunning -lt 1 ]; then&lt;br /&gt;
               if [ -f $tDirHome$tDirUser/.1.flc ]; then&lt;br /&gt;
                  if [ -f $tDirHome$tDirUser/.2.flc ]; then&lt;br /&gt;
                     # GET THE DYNAMIC INFORMATION FOR THE EMAIL&lt;br /&gt;
                     tSize=`du -sb $tDirHome$tDirUser/backup/ | awk &amp;#039;{print $1}&amp;#039;&lt;br /&gt;
                     tDate1=`cat $tDirHome$tDirUser/.began | awk &amp;#039;{print $1&amp;quot; &amp;quot;$2&lt;br /&gt;
                     # SUBSITUTE IN THE DYNAMIC INFORMATION&lt;br /&gt;
                     tEmailBody=$tEmailBad&lt;br /&gt;
                     tEmailBody=${tEmailBody/&amp;lt;&amp;lt;USER&amp;gt;&amp;gt;/$tEmailName}&lt;br /&gt;
                     tEmailBody=${tEmailBody/&amp;lt;&amp;lt;DT1&amp;gt;&amp;gt;/$tDate1}&lt;br /&gt;
                     tEmailBody=${tEmailBody/&amp;lt;&amp;lt;SIZE&amp;gt;&amp;gt;/$tSize}&lt;br /&gt;
                     # SEND THE MAIL&lt;br /&gt;
                     echo -en &amp;quot;From: Drow &amp;lt;*****EMAILL ADRESS HIDDEN TO AVOID SPAM*****&amp;gt;\nSubject: Ba&lt;br /&gt;
                     echo -e $tEmailBody &amp;gt;&amp;gt; email.temp&lt;br /&gt;
                     cat email.temp | ssmtp $tEmailAddy&lt;br /&gt;
                     # DELETE ALL THE FLAG FILES&lt;br /&gt;
                     if [ -f $tDirHome$tDirUser/.began ]; then rm -f $tDirHome$t&lt;br /&gt;
                     if [ -f $tDirHome$tDirUser/.ended ]; then rm -f $tDirHome$t&lt;br /&gt;
                     if [ -f $tDirHome$tDirUser/.1.flc ]; then rm -f $tDirHome$t&lt;br /&gt;
                     if [ -f $tDirHome$tDirUser/.2.flc ]; then rm -f $tDirHome$t&lt;br /&gt;
                  else&lt;br /&gt;
                     # CREATE FLC FILE HERE&lt;br /&gt;
                     touch $tDirHome$tDirUser/.2.flc&lt;br /&gt;
                  fi&lt;br /&gt;
               else&lt;br /&gt;
                  # CREATE FLC FILE HERE&lt;br /&gt;
                  touch $tDirHome$tDirUser/.1.flc&lt;br /&gt;
               fi&lt;br /&gt;
            fi&lt;br /&gt;
         fi&lt;br /&gt;
      fi;&lt;br /&gt;
   fi&lt;br /&gt;
done;&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/sbin/flc/backup_rotate.sh===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
###############################################################################&lt;br /&gt;
# BACKUP_ROTATE.SH BY FRANK CARDOZA - 02.11.2006&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
tDirHome=&amp;quot;/share/jail/home/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# START LOG FILE FOR STATUS EMAIL&lt;br /&gt;
echo -en &amp;quot;From: Drow &amp;lt;*****EMAILL ADRESS HIDDEN TO AVOID SPAM*****&amp;gt;\nSubject: Rotation Report\n\n&amp;quot; &amp;gt;&lt;br /&gt;
echo &amp;quot;Rotating backups on `date`&amp;quot; &amp;gt;&amp;gt; rotate.log&lt;br /&gt;
echo &amp;quot;-----------------------------------------------------------&amp;quot; &amp;gt;&amp;gt; rotate.log&lt;br /&gt;
&lt;br /&gt;
tRotateCnt=0&lt;br /&gt;
&lt;br /&gt;
# LOOP THROUGH ALL THE HOME DIRECTORIES&lt;br /&gt;
for tDirUser in `ls $tDirHome`&lt;br /&gt;
do&lt;br /&gt;
   if [ -f $tDirHome$tDirUser/.rotate ] &amp;amp;&amp;amp; [ -d $tDirHome$tDirUser/backup ]; the&lt;br /&gt;
      tDirToRotate=$tDirHome$tDirUser/rotations/backup&lt;br /&gt;
      # DELETE .rotate FLAG FILE&lt;br /&gt;
      rm -f $tDirHome$tDirUser/.rotate&lt;br /&gt;
      # MAKE SURE THE ROTATION DIRECTORY EXISTS&lt;br /&gt;
      if [ ! -d $tDirHome$tDirUser/rotations ] ; then&lt;br /&gt;
         mkdir $tDirHome$tDirUser/rotations&lt;br /&gt;
      fi&lt;br /&gt;
      # ADD TO LOG&lt;br /&gt;
      echo $tDirUser &amp;gt;&amp;gt; rotate.log&lt;br /&gt;
      ((tRotateCnt++))&lt;br /&gt;
      # IF EXISTS, THEN DELETE THE OLDEST BACKUP&lt;br /&gt;
      if [ -d $tDirToRotate.7 ] ; then&lt;br /&gt;
         rm -rf $tDirToRotate.7&lt;br /&gt;
      fi&lt;br /&gt;
      # IF THEY EXIST, THEN ROTATE PREVIOUS BACKUPS&lt;br /&gt;
      if [ -d $tDirToRotate.6 ] ; then&lt;br /&gt;
         mv $tDirToRotate.6 $tDirToRotate.7&lt;br /&gt;
      fi&lt;br /&gt;
      if [ -d $tDirToRotate.5 ] ; then&lt;br /&gt;
         mv $tDirToRotate.5 $tDirToRotate.6&lt;br /&gt;
      fi&lt;br /&gt;
      if [ -d $tDirToRotate.4 ] ; then&lt;br /&gt;
         mv $tDirToRotate.4 $tDirToRotate.5&lt;br /&gt;
      fi&lt;br /&gt;
      if [ -d $tDirToRotate.3 ] ; then&lt;br /&gt;
         mv $tDirToRotate.3 $tDirToRotate.4&lt;br /&gt;
      fi&lt;br /&gt;
      if [ -d $tDirToRotate.2 ] ; then&lt;br /&gt;
         mv $tDirToRotate.2 $tDirToRotate.3&lt;br /&gt;
      fi&lt;br /&gt;
      if [ -d $tDirToRotate.1 ] ; then&lt;br /&gt;
         mv $tDirToRotate.1 $tDirToRotate.2&lt;br /&gt;
      fi&lt;br /&gt;
      # HARD LINK LATEST BACKUP TO BACKUP.1&lt;br /&gt;
      cp -al $tDirHome$tDirUser/backup $tDirToRotate.1&lt;br /&gt;
   fi&lt;br /&gt;
done;&lt;br /&gt;
&lt;br /&gt;
# MAIL THE LOG&lt;br /&gt;
if [ &amp;quot;$tRotateCnt&amp;quot; -gt &amp;quot;0&amp;quot; ]; then&lt;br /&gt;
   echo &amp;quot;-----------------------------------------------------------&amp;quot; &amp;gt;&amp;gt; rotate.&lt;br /&gt;
   echo &amp;quot;TOTAL ROTATIONS: $tRotateCnt&amp;quot; &amp;gt;&amp;gt; rotate.log&lt;br /&gt;
   cat rotate.log | ssmtp *****EMAILL ADRESS HIDDEN TO AVOID SPAM*****&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
exit 0;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/sbin/flc/blockssh.sh===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script is called by /etc/rc.local&lt;br /&gt;
#########################################################################&lt;br /&gt;
# Wait 60 seconds just in case bad things happen (tm) and I need a way in&lt;br /&gt;
sleep 60&lt;br /&gt;
# Allow established/related connections&lt;br /&gt;
/sbin/iptables -A INPUT --protocol all -m state --state ESTABLISHED,RELATED --jump ACCEPT&lt;br /&gt;
# Block ssh&lt;br /&gt;
/sbin/iptables -A INPUT --protocol tcp --dport 22 --jump DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/sbin/flc/email.bad===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Hello &amp;lt;&amp;lt;USER&amp;gt;&amp;gt;,\n&lt;br /&gt;
\nYour backup started transfering at &amp;lt;&amp;lt;DT1&amp;gt;&amp;gt; and never finished.  You may have a&lt;br /&gt;
\n\nKind Regards,&lt;br /&gt;
\nDrow (Your friendly backup server).\n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/sbin/flc/email.good===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Hello &amp;lt;&amp;lt;USER&amp;gt;&amp;gt;,\n&lt;br /&gt;
\nYour backup sucessully started transfering at &amp;lt;&amp;lt;DT1&amp;gt;&amp;gt; and completed at &amp;lt;&amp;lt;DT2&amp;gt;&amp;gt;&lt;br /&gt;
\n\nKind Regards,\n&lt;br /&gt;
\nDrow (Your friendly backup server).\n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/sbin/flc/silentfan.sh===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Frank Cardoza&lt;br /&gt;
# Turn off/on fan based on temperature and state of HD&lt;br /&gt;
&lt;br /&gt;
tCurrentState=`/sbin/hdparm -C /dev/hda | /bin/grep &amp;#039;standby&amp;#039; -c`&lt;br /&gt;
if [ $tCurrentState == 1 ] ; then&lt;br /&gt;
  echo -n &amp;quot;\\\\\\\\&amp;quot; &amp;gt; /dev/ttyS0&lt;br /&gt;
else&lt;br /&gt;
  tTHD=`/usr/sbin/smartctl -A /dev/hda | /usr/bin/awk &amp;#039;/^194/ {print($10)}&amp;#039;`&lt;br /&gt;
  if [ $tTHD -lt 40 ] ; then&lt;br /&gt;
    echo -n &amp;quot;\\\\\\\\&amp;quot; &amp;gt; /dev/ttyS0&lt;br /&gt;
  else&lt;br /&gt;
    echo -n &amp;quot;]]]]&amp;quot; &amp;gt; /dev/ttyS0&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/sbin/flc/silentfan_cron.sh===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; Why have a script to simply call another script?  Well, for whatever reason, the LS will lock up if you call the other script directly from cron.  It has something to do with the avr and this hack works around the issue.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/sbin/flc/silentfan.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
===/var/www/cgi-bin/movies.cgi===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/perl -w&lt;br /&gt;
&lt;br /&gt;
$tPath = &amp;quot;/share/movies&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Content-type: text/html\n\n&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
sub escape&lt;br /&gt;
{&lt;br /&gt;
  my $str = shift || &amp;#039;&amp;#039;;&lt;br /&gt;
  $str =~ s/([^\w.-])/sprintf(&amp;quot;%%%02X&amp;quot;,ord($1))/eg;&lt;br /&gt;
  $str;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (($ENV{&amp;#039;REQUEST_METHOD&amp;#039;} eq &amp;#039;GET&amp;#039;) &amp;amp;&amp;amp; ($ENV{&amp;#039;QUERY_STRING&amp;#039;} ne &amp;quot;&amp;quot;))&lt;br /&gt;
{&lt;br /&gt;
  @pairs = split(/&amp;amp;/, $ENV{&amp;#039;QUERY_STRING&amp;#039;});&lt;br /&gt;
  foreach $pair (@pairs)&lt;br /&gt;
  {&lt;br /&gt;
    ($name, $value) = split(/=/, $pair);&lt;br /&gt;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(&amp;quot;C&amp;quot;, hex($1))/eg;&lt;br /&gt;
    #print &amp;quot;$name = $value&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
    if ($name eq &amp;quot;move&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
      if( -d &amp;quot;$tPath/$value&amp;quot;)&lt;br /&gt;
      {&lt;br /&gt;
        system &amp;quot;mv \&amp;quot;$tPath/$value\&amp;quot; \&amp;quot;$tPath/old/\&amp;quot;&amp;quot;;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;&amp;lt;script language=JavaScript&amp;gt;&amp;quot;;&lt;br /&gt;
print &amp;quot;function CheckMove(tFile){&amp;quot;;&lt;br /&gt;
print &amp;quot;if (confirm(&amp;#039;Are you sure you want to move &amp;#039; + tFile + &amp;#039;?&amp;#039;))&amp;quot;;&lt;br /&gt;
print &amp;quot;{ document.location = &amp;#039;/cgi-bin/movies.cgi?move=&amp;#039; + tFile }&amp;quot;;&lt;br /&gt;
print &amp;quot;}&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
opendir(DIR, $tPath);&lt;br /&gt;
@files = grep(/\.*$/,readdir(DIR));&lt;br /&gt;
closedir(DIR);&lt;br /&gt;
&lt;br /&gt;
foreach $file (@files)&lt;br /&gt;
{&lt;br /&gt;
  if( -d &amp;quot;$tPath/$file&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
    if ($file ne &amp;#039;new&amp;#039; &amp;amp;&amp;amp; $file ne &amp;#039;old&amp;#039; &amp;amp;&amp;amp; $file ne &amp;#039;.&amp;#039; &amp;amp;&amp;amp; $file ne &amp;#039;..&amp;#039;)&lt;br /&gt;
    {&lt;br /&gt;
      $esc_file = escape($file);&lt;br /&gt;
      print &amp;quot;&amp;lt;a href=&amp;#039;javascript:CheckMove(\&amp;quot;$esc_file\&amp;quot;)&amp;#039;&amp;gt;[MOVE]&amp;lt;/a&amp;gt; $file&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ohayden</name></author>
	</entry>
</feed>