Archive for May, 2009

If you have ever wanted to display a message to your users when the log in through ssh, you just need to edit a couple of files.  The first one is:

vi /etc/motd

This file has the text that will be displayed when an authorized user logs in through SSH.  The next change we need to make is to the SSH configuration file, which tell it to display the MOTD (message of the day).  The file can be found here, on a CentOS 5 system:

vi /etc/ssh/sshd_config

Look for the line containing PrintMotd and change the value to yes.  Make sure it is also uncommented.  If you wish to have a custom message for each user, it can be done a couple of different ways, however, I will only show you one.  We will create a new directory, and within that directory, give each user that has SSH access a file to use for a custom message.  Then, we need to edit the login script that the users use, in this case, bashrc, to include the per user file.

mkdir /etc/usermotd  <– makes the directory that we will use

vi /etc/usermotd/username <– this is where you would add the text you wish to display.

vi /etc/bashrc <– edit the bash file to include our new user motd

You need to add the below to the bottom of the bashrc file:

if [ -f /etc/usermotd/${USER} ]; then
cat /etc/usermotd/${USER};
fi

Save & quit

You are done !!!

awstats outside cPanel

Follow the steps below to access the awstats outside the cPanel

Step 1.

Download awstats

root@master [~]# cd /home/username/public_html
root@master [~]# wget http://prdownloads.sourceforge.net/awstats/awstats-6.9.tar.gz

Step 2.

Uncompress  awstats-5.6.tgz

root@master [~]# tar -zxvf awstats-6.9.tar.gz

Step 3.

Copy the contents of the uncompressed cgi-bin folder from your hard drive to the user  cgi-bin directory (this includes awstats.pl, awstats.model.conf, and the lang, lib and plugins sub-directories).

root@master [~]# cp -af awstats-6.9/wwwroot/cgi-bin .

Step 4.

If necessary (should not be needed with most setups), edit the first (top-most) line of awstats.pl file that is
#!/usr/bin/perl
to reflect the path were your Perl interpreter is installed. Default value works for most of Unix OS, but it also might be
#!/usr/local/bin/perl

root@master [~]# which perl
root@master [~]# vi cgi-bin/awstats.pl

Step 5.

Move AWStats icon sub-directories and its content into a directory readable by your web server, for example /home/users/public_html/icons

root@master [~]# cp -af awstats-6.9/wwwroot/icon .

Step 6.

Copy awstats.model.conf file into a new file named awstats.myvirtualhostname.conf. This new file must be stored in
/home/user/public_html/cgi-bin.

root@master [~]# cp -af cgi-bin/awstats.model.conf cgi-bin/awstats.domain.conf

Step 7.

Edit this new config file with your own setup :
- Change LogFile value with full path of your web server log file
(The path is:
LogFile=”/usr/local/apache/domlogs/domain.com”).

- Check if LogFormat has the value “1″ (it means “NCSA apache combined/ELF/XLF log format”).

- Change DirIcons parameter to reflect relative path of icon directory.
(DirIcons=”/home/username/public_html/icons”)

- Edit SiteDomain parameter with the main domain name or the intranet web server name used to reach the web site to analyze (Example: www.mydomain.com).

IMPORTANT!
- Change DirData to use the same Statics file than Cpanel Awstats and do not loose any entry.
(DirData=”/home/user/tmp/awstats/”)

Step 8.

Access AwStats by the URL:

www.domain.com/cgi-bin/awstats.pl?config=domain.com

That’s all!!!

The AwStats will refresh the Statics every 24 Hours.

100% Customer Satisfaction