Archive for March 12th, 2011

How to exclude files and directories from tar archive on Debian Linux / (Cannot open: No such file or directory) cause and solution

Saturday, March 12th, 2011

I’m using a custom script to create the backups of file data on the Linux servers which I administrate.

The script does backup a complete directory with it’s subdirectory structures, however sometimes on one of the servers there was a requirement that some of the directories which are used as cache directories and grow really high in Gigabytes to be excluded from the tar archive.
The server where I have already set up my data backup solution is running Debian Linux and therefore I needed to modify my site_backups.sh file data backup script to exclude a number of directories from my target backup directory /home/mydata/ .

I haven’t recently used the tar –exclude option, so I had to experiment a bit with the option, check some info online and check the tar manual.

After my little experiments finally I found out the proper way to exclude files from my tar archives and decided to put it on my blog in hope that it might be of use to some other Linux / Mac hobbyists out there.

Here is how I was able to properly exclude my directories from my tar archive:

debian:~# /bin/tar -czvf my_tar_archive_name.tar.gz /home/mydata
--exclude="{"/home/mydata/dirtoexclude1/*",
"/home/mydata/dirtoexclude2/*","/home/mydata/dirtoexcludeN/*"}

Note that it is possible to put each of the excluded directory under a separate –exclude like for instance:

debian:~# /bin/tar -czvf my_tar_archive_name.tar.gz /home/mydata
--exclude='/home/mydata/exampledirtoexclude1/*'
--exclude='/home/mydata/exampledirtoexclude2/*'

Note that I experienced problems with setting the directories to be exclude if I try to place the tar –exclude option before the specified target directory to be placed in the archive.
Just to give you an example if you try to set the tar exclude like:

debian:~# /bin/tar -czvf my_tar_archive_name.tar.gz
--exclude="{"/home/mydata/dirtoexclude1/*",
"/home/mydata/dirtoexclude2/*","/home/mydata/dirtoexcludeN/*"} /home/mydata

You will get errors indicating the excluded directories as missing, if you try to invoke the exclude as shown in the 3rd command example you will get errors like:

/bin/tar: --exclude=/home/mydata/dirtoexclude1/*: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now

Just in case if you’re experiencing this tar error whether trying to exlude directory this is probably caused by the wrong placement of the –exclude tar command directive, just change the –exclude option placement as shown in the first two commands in my post and the exclude will be fine.

How to enable CAPTCHA (Visual Confirmation) on Debian PHPBB Forum ver 3.0.2-4

Saturday, March 12th, 2011

I have a phpbb forum for a while now and as it’s now indexed in seach engines Google, Yahoo, Bing, Yandex etc. the forum is already tortured by dozen of spam bots crawling with requests to register.
For a few months already I’ve configured the new registration requests in the forum to demand adminstrator confirmation.

However my administrator configured email address is receiving tons of spam (requests of spam bots for new users registration).
The whole purpose of the spam bots are to register on my phpbb board in order to post spam links and that way increase certain pages pagerank in search engines, pretty nasty …

My phpbb forum is happily installed on a Stable release of Debian Lenny and my exact installed phpbb3 package version is 3.0.2-4

Luckily this version of phpbb board includes already embedded support for Visual Confirmation (e.g. CAPTCHA support).

In order to enable this support these are the exact steps I had to follow:

1. Login to phpbb forum with admin user
2. Go to bottom of the forum and click over Administration Control Panel
3. Navigate to:

GENERAL -> BOARD CONFIGURATION (Visual confirmation settings)

On the screen which will appear in General options make sure the following options are set:

Enable visual confirmation for registrations: Enabled
Enable visual confirmation for guest postings
GD Captcha: Yes
GD Captcha foreground noise: Yes

Now simply press the Submit which is located in the bottom and the CAPTCHA in new user registration on your phpbb forum will appear.