Modify or Adjust File Date Time on Unix/Linux

You have folders or files in your server last modified date/time was 3 months ago, sometime for some reason we would like to change files or folders last modified date/time to older or recent date. You can modify the date/time of a folder or file with Unix/Linux touch command.

For example I have a file name wireless.pcap, last update or created was in year 2009. I can change the last modify time by the touch command touch -t yyyymmddhhmm filename

shell> touch -t 201007101540 wireless.pcap

This will change the file last updated date and time to 10th July 2010 15:40pm.

How to Create User with useradd in FreeBSD

You can invoke “adduser” command in FreeBSD in order to create new user. Adduser will prompt you for user info like name, uid, gid, shell environment and etc. But sometime we would like to create user access through Bash script. “useradd” command is the good way to do it.

In Linux, using “useradd” is pretty common for creating new user access. You can also use “useradd” in FreeBSD, but not directly invoke “useradd” command. Below is the sample of creating new user in FreeBSD with “useradd”.

shell> pw useradd cheryl -c 'Cheryl Windows Admin' -d /home/cheryl -s /usr/local/bin/bash

New user account is created, but don’t forgot to set password for the account

shell> passwd cheryl

You can run other command like “userdel”, “usermod”, “usershow”, “groupadd”, “groupdel”, “groupmod”, “lock”, “unlock” on FreeBSD by using the “pw” command.

Install and Configure mod_suphp or suphp on Plesk Server

Plesk control panel comes with Media Temple DV package doesn’t support suphp/mod_suphp. I like suphp, it gives you the user/group permission as the control panel created for you, so that you will have the permission to read/write on your own files/folders.

I mentioned before that I got Dedicated Virtual (DV) VPS package from Media Temple previously. It has been a while since I subscribed with Media Temple. So far I am happy with their services and I have moved my blog over to Media Temple 2 months ago. Since then I never bother to patch my WordPress until Version 3 released, mainly was because I am too lazy to download, backup, untar, copy over for upgrade. I prefer the One Click WordPress Upgrade option, yes.. That’s how Lazy I am!

I just had mod_suphp installed on my Plesk, and first thing is I did was upgraded my WordPress to Version 3, well also all my plugins. Here is the how-to of suphp installation and configuration on Media Temple Dedicated Virtual package.

First, install mod_suphp from yum

shell> yum install mod_suphp

After installation, you should see suphp configuration files located at

On mod_suphp.conf, you can refer to the configuration I have below;

LoadModule suphp_module modules/
suPHP_AddHandler php5-script
suPHP_Engine on

You will notice that the Handler is php5-script, it’s the php’s handler configured on Plesk, so we will not disturb that. You need to make the handler recognize on suphp, and follow the configuration for /etc/suphp.conf

;Path to logfile


;User Apache is running as

;Path all scripts have to be in

; Security options

;Check wheter script is within DOCUMENT_ROOT

;Send minor error messages to browser

;PATH environment variable

;Umask to set, specify in octal notation

; Minimum UID

; Minimum GID

; Use correct permissions for mod_userdir sites
; handle_userdir=false

;Handler for php-scripts

;Handler for CGI-scripts

After restart apache services, all your website hosted on the server will have suphp support, you might want to check all the permission of your files and folders before restart apache. Make sure the folder is mod is 755 and file mod is 644.

You can do the quick mod change with find command

shell> find /var/www/vhost/domain-name/httpdocs/* -type f -exec chmod 644 {} \;
shell> find /var/www/vhost/domain-name/httpdocs/* -type d -exec chmod 755 {} \;

That’s it! mod_suphp on Plesk. Nice and Clean.

Razor2 Error: No such file or directory report requires authentication

While doing Spam Report on SpamAssassin, I came across this error message,

reporter: razor2 report failed: No such file or directory report requires authentication at /usr/local/lib/perl5/site_perl/5.x.x/Mail/SpamAssassin/Plugin/ line 180. at /usr/local/lib/perl5/site_perl/5.x.x/Mail/SpamAssassin/Plugin/ line 330.

I checked the file existed, so It’s something to do with Razor authentication. This is what you need to do fix the error message from SpamAssassin.

shell> razor-admin -create
shell> razor-admin -register

Upgrade to php52 on FreeBSD

By default, after portsnap to latest FreeBSD port tree, it will upgrade your php5.2 to php5.3 automatically. There isn’t any option where you can to remain your PHP version to 5.2.

In order to keep my PHP applications running on PHP version 5.2, what I did is upgrade all php5-* packages to php52-*, but it will be a little waste of time if doing it manually, port by port.

So I written this simple bash to output me the packages of php5-* which need to upgrade to php52-*

for d in `portversion -vL= | grep php5 | awk '{print $1}'`; do  OLD=`echo $d | cut -d - -f 1,2`; NEW=`echo $d | sed s/php5/php52/ | cut -d - -f 1,2`; THEPATH=`whereis $NEW | awk '{print $2}' | cut -d / -f 4,5`; echo "portupgrade -o $THEPATH $OLD && \\"; done

The bash will actually output

portupgrade -o textproc/php52-simplexml php5-simplexml && \
portupgrade -o devel/php52-spl php5-spl && \
portupgrade -o databases/php52-sqlite php5-sqlite && \
portupgrade -o devel/php52-tokenizer php5-tokenizer && \
portupgrade -o textproc/php52-xml php5-xml && \
portupgrade -o textproc/php52-xmlreader php5-xmlreader && \
portupgrade -o textproc/php52-xmlwriter php5-xmlwriter && \
portupgrade -o archivers/php52-zip php5-zip && \
portupgrade -o archivers/php52-zlib php5-zlib && \ 

Before upgrading the php extensions package, upgrade your php52 as below

portupgrade -o lang/php52 php5

On the last time, remember to remove “&& \”, or you can press enter key twice to activate the upgrade.