JSP and Tomcat version

The below code will help you to find the JSP, tomcat and servlet versions installed in your server or domain.

Working with server: <%= application.getServerInfo() %><br>
Servlet Specification: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %> <br>
JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().get SpecificationVersion() %><br>

Create a test page checkjsp.jsp with above code in your domain. Check the test page by using browser “http://yourdomainname/checkjsp.jsp“. It will show the tomcat version, JSP and servlet version in your domain.

Your Internet Address has changed since the beginning of your Mail session. To protect your security, you must login again

If you are unable to login into Webmail , and you are getting an Error: “Your Internet Address has changed since the beginning of your Mail session. To protect your security, you must login again.”

To fix this problem, you may do the following:

1)You can turn off ‘checkip’ feature in Horde server-wide.

2)Edit the /usr/share/psa-horde/config/conf.php file in the Plesk server and the change the following lines.

$conf[‘auth’][‘checkip’] = true;
to
$conf[‘auth’][‘checkip’] = false;

Please note that this modification cannot be configured per user basis and will affect all the webmail users in the server.

change password expiry in zimbra mail account

To change the password expiry time for a zimbra mail account, please follow the steps below.

[zimbra@geo ~]$ zmprov ma geo@geobaby.in zimbraPasswordMaxAge 36500

This modifies the value. To see if the new value is set, use the command:

[zimbra@geo~]$ zmprov ga geo@geobaby.in zimbraPasswordMaxAge
# name geo@geobaby.in
zimbraPasswordMaxAge: 36500

This can also be done from admin panel, goto account >> edit >> advanced >>  Maximum password age (Days).

http://www.zimbra.com/forums/administrators/35696-password-expiry-email-notification.html

Spamd / Spamassassin error : argument isn’t numeric in addition / unparseable IPv6 address

I encountered the following error while restarting spamassassin.

Starting spamd: Feb 21 20:29:26.275 [8814] warn: Argument “” isn’t numeric in addition (+) at /usr/local/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/NetSet.pm line 122.
Feb 21 20:29:26.276 [8814] warn: oops! unparseable IPv6 address for 127/8: 168355856 at /usr/local/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/NetSet.pm line 128.
Feb 21 20:29:26.276 [8814] warn: oops! unparseable IPv6 address for 127/8: 168356228 at /usr/local/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/NetSet.pm line 128.
child process [8816] exited or timed out without signaling production of a PID file: exit 255 at /usr/bin/spamd line 2582.

The work around I found is to change cpanel to stable version and run upcp.

then do this,

sa-learn -D –force-expire
sa-update -D
/usr/local/cpanel/scripts/spamassassin_dbm_cleaner
/usr/local/cpanel/scripts/fixspamassassinfailedupdate
/scripts/restartsrv_spamd

This should fix the issue.

Glipper crashed with ValueError in load()

I found out that klipper is not working well in Ubuntu 11.10 version. I installed glipper in my machine and after a reboot, met with this error.

glipper crashed with ValueError in load(): invalid literal for int() with base 10: “\xcb#W\x84\xb0\x0e […] \r”

The workaround appears to be to just forget about the invalid history file (or move it away):

$ rm ~/.local/share/glipper/history

geo@ubuntu:~$ ll .local/share/glipper/history
-rw-rw-r– 1 geo geo 27041 2012-02-16 10:28 .local/share/glipper/history
geo@ubuntu:~$ rm -f .local/share/glipper/history

geo@ubuntu:~$ glipper &
[1] 7221
geo@ubuntu:~$ SHARED_DATA_DIR: /usr/share/glipper
Binding shortcut c to popup glipper
Changed process name to: glipper

Glipper started working again…

How To Find Large Files and Directories in Unix

Sometimes we need to find larger files in a file system when theres is a disk space issue.

This example finds all the files under /etc directory which are larger than 1000k:

geobaby@ubuntu:~$ find /etc -size +1000k
/etc/brltty/zh-tw.ctb

If you look at the file, the size if above 1000k:

geobaby@ubuntu:~$ ls -l /etc/brltty/zh-tw.ctb
-rw-r–r– 1 root root 1368836 2010-08-12 05:20 /etc/brltty/zh-tw.ctb

The following example will be helpful in cPanel or web servers.

find / -size +1000M : will list all the files above 1GB size.

find / -size +1000M > list

for i in `cat list`; do du -sch $i;done : will list all the files and their resoective size.

How to mount SFTP share in Linux machine

This could be implemented using both FUSE and SSHFS.

Download both from  http://fuse.sourceforge.net/sshfs.html

1. Install FUSE

package: fuse-x.tar.gz

Extract and install
#tar xvf fuse-x.tar.gz
#cd fuse-x
#./configure
#make
#make install

After successful installation, install SSHFS

package: sshfs-fuse-x.tar.gz

Extract and install
#tar xvf sshfs-fuse-x.tar.gz
#cd sshfs-fuse-x
#./configure
#make
#make install

Now we can use sshfs to mount sftp share. Before mounting, create mount point where the share to be mounted.

#mkdir /mnt/sftpshare

Mount command:  sshfs <username>@<sftpserver IP/host>:/<sftp_share_path> /<mountpoint>

Eg:
#sshfs testuser@192.168.1.2:/home/testuser /mnt/sftpshare/

This will prompt for password if user configured any password.

NOTE:  If you want to avoid prompting for password,then you should configure key based ssh login between these servers.

Verify the mounted partition using df command.

To mount this share directory in boot time, add the following entry in /etc/fstab

sshfs#testuser@192.168.1.2:/home/testuser     /mnt/sftpshare          fuse                   defaults        0 0

NOTE:     For unmounting this partition,we can use fusermount command as below
#fusermount -u /mnt/sftpshare/

Reference: http://www.coretimer.com/howtos/how-to-mount-sftp-share-in-remote-linux-machine/

how to remove an IP from the cphulkd blacklist

cPHulk Brute Force Protection prevents malicious forces from trying to access your server’s services by guessing the login password for that
service.

By the following steps you can remove the IP from the cphulkd blacklist. Issue the commands from mysql prompt.

mysql> use cphulkd;

mysql> select * from brutes;
+————–+————————————————————————-+———————+———————+
| IP | NOTES | BRUTETIME | EXPTIME |
+————–+————————————————————————-+———————+———————+
| 4.9.23.6 | 5 login failures attempts to account geo@geo.com (ftp) | 2011-01-07 14:54:02 | 2011-01-07 14:59:02 |
+————–+————————————————————————-+———————+———————+
1 row in set (0.00 sec)

mysql> delete from brutes where IP=’4.9.23.6′;
Query OK, 1 row affected (0.00 sec)

mysql>quit

You are done.

Dump Mysql Tables

Often you have encountered problems while importing large databases via phpmyadmin. In that case, you can dump the mysql tables by using the following command.

for T in `mysql -N -B -e ‘show tables from database_name’`; do echo $T;    mysqldump database_name  $T > database_name_$T.gz ;    done

Now you can restore the tables one by one through phpmyadmin.