Archive for May, 2009

SBDavid

Moving /var/lib/mysql

Moving /var/lib/mysql

If you want to move the data which is stored in “/var” to another partition.

To move that path to another partition, run the following:

cd /home
mkdir mysql
chown mysql:mysql mysql
cd mysql
/sbin/service mysqld stop
cp -Rp /var/lib/mysql/* .
cd /var/lib
mv mysql mysql_old
ln -s /home/mysql ./mysql
/sbin/service mysqld start

Once satisfied that mysqld is running, remove the old data:

rm -rf mysql_old

How to use kvm with a non-privileged user?

The cleanest way is probably to create a group, say kvm, and add the user(s) to that group. Then you will need change /dev/kvm to owned by group kvm.

On a system that runs udev, you will probably need to add the following line somewhere in your udev configuration so it will automatically give the right group to the newly created device (i-e for ubuntu add a line to /etc/udev/rules.d/40-permissions.rules).

KERNEL==”kvm”, GROUP=”kvm”

How can I tell if I have Intel VT or AMD-V?

With a recent enough Linux kernel, run the command:

egrep ‘^flags.*(vmx|svm)’ /proc/cpuinfo

If something shows up, you have VT. You can also check the processor model name (in `/proc/cpuinfo`) in the vendor’s web site.

/proc/cpuinfo only shows virtualization capabilities starting with Linux 2.6.15 (Intel) and Linux 2.6.16 (AMD). Use the `uname -r` command to query your kernel version.

How to Fix Internal Server Error for cgi script.

Internal Server Error for cgi script means that the cgi script did not execute properly.

1) check the /var/log/httpd/suexec_log. It contains any errors that would be as a result of not having correct permissions on the file.

2)The file needs to be in a cgi-bin and must have the owner/group as the username who owns the site.

3)The most common chmod permission is 755, the script must have execute permission.

4)The easiest way to figure out script coding problems is to first run the script manually from an ssh prompt.

./script.cgi

5)Other errors that would be generated when running the script manually from ssh would be missing perl modules.

6)Cpan is the easiest method to install new perl modules.

SBDavid

Linux Security Audit Tools

Linux Security Audit Tools

Chkrootkit - Scan system for trojans, worms and exploits.

Root kit detection tools:

checkps - detect rootkits by detecting falsified output and similar anomalies. The ps check should work on anything with /proc. Also uses netstat.

Rootkit hunter - scans for rootkits, back doors and local exploits

Rkdet - root kit detector daemon. Intended to catch someone installing a rootkit or running a packet sniffer.

fsaudit
- Perl script to scan filesystems and search for suspicious looking directories.

« Prev - Next »