Nov
28

#!/bin/sh
date=`date ‘+%m-%d-%y’` (This is if you need time date and year of the backup which is a must)
mysqldump -upva_test -ppva_test > /home/pva/mysql_backup/pva_test.$date.sql (This will take your mysql database backup)
chown pva:pva mysql_backup -R (This will change the ownership of the file as this script will create backup file with root as owner)

Comments Off    Read More   
Nov
28
To fix these errors you simply need to use the quotacheck command to rebuild the quota databases. Basic quotacheck usage is simple. First you disable quotas using the “quotaoff” command, then delete (or rename) the existing quota database (the files called quota.user and quota.group), then use quotacheck to rebuild the database, then turn quotas back on with the “quotaon” command. For example:quotaoff -av
mv /aquota.user /aquota.user.bak
mv /aquota.group /aquota.group.bak
quotacheck -agiuv
quotaon -av

Note that this is an example only. The exact location of your aquota.user and aqouta.group may vary and these files may be called simply quota.user and quota.group. You may also have more than one copy of these files if you have quotas enabled for more than one filesystem. Check in /etc/fstab to see which filesystems have quotas enabled. Filesystems with quotas enabled will have the usrquota and grpquota options turned on. So, for example, if your /etc/fstab has lines like these in it

LABEL=/ / ext3 usrquota,grpquota,defaults 1 1
/dev/hda3 /home ext3 defaults 1 2

Then your / and /home filesystems have quotas enabled and there will be two sets of aquota files to delete or rename: /aquota.* and /home/aquota.*

Try to rebuild quotas when the server is not busy, and, if you can, shutdown httpd, ftp and other non-essential services so that nothing is trying to change the files on disk while the quotas are being rebuilt. It is not absolutely necessary to run quotacheck on an inactive system, but if there is activity then errors can creep into the disk space usage count. Shutting down the system services will also help the quotacheck to run faster.

Comments Off    Read More   
Utility to dump a database or a collection of database for backup or for transferring the data to another SQL server (not necessarily a MySQL server). The dump will contain SQL statements to create the table and/or populate the table.
Syntax:
Code:
shell> mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] –databases [OPTIONS] DB1 [DB2 DB3…]
OR mysqldump [OPTIONS] –all-databases [OPTIONS]If you don’t give any tables or use the –databases or –all-databases, the whole database(s) will be dumped.
You can get a list of the options your version of mysqldump supports by executing
Code:
mysqldump –help.

Note that if you run mysqldump without –quick or –opt, mysqldump will load the whole result set into memory before dumping the result. This will probably be a problem if you are dumping a big database.
Note that if you are using a new copy of the mysqldump program and you are going to do a dump that will be read into a very old MySQL server, you should not use the –opt or -e options.
mysqldump supports the following options:
–add-locks

Add LOCK TABLES before and UNLOCK TABLE after each table dump. (To get faster inserts into MySQL.)
–add-drop-table
Add a drop table before each create statement.
-A, –all-databases
Dump all the databases. This will be same as –databases with all databases selected. -a, –all
Include all MySQL-specific create options.
–allow-keywords
Allow creation of column names that are keywords. This works by prefixing each column name with the table name.
-c, –complete-insert

Use complete insert statements (with column names).
-C, –compress
Compress all information between the client and the server if both support compression.
-B, –databases

To dump several databases. Note the difference in usage. In this case no tables are given. All name arguments are regarded as database names. USE db_name; will be included in the output before each new database.
–delayed Insert rows with the INSERT DELAYED command.
-e, –extended-insert
Use the new multiline INSERT syntax. (Gives more compact and faster inserts statements.)
-#, –debug[=option_string]
Trace usage of the program (for debugging).
–help
Display a help message and exit.
–fields-terminated-by=…
–fields-enclosed-by=…
–fields-optionally-enclosed-by=…
–fields-escaped-by=…
–lines-terminated-by=…
These options are used with the -T option and have the same meaning as the corresponding clauses for LOAD DATA INFILE.
-F, –flush-logs
Flush log file in the MySQL server before starting the dump.
-f, –force,
Continue even if we get a SQL error during a table dump.
-h, –host=..
Dump data from the MySQL server on the named host. The default host is localhost. -l, –lock-tables.
Lock all tables before starting the dump. The tables are locked with READ LOCAL to allow concurrent inserts in the case of MyISAM tables. Please note that when dumping multiple databases, –lock-tables will lock tables for each database separately. So using this option will not guarantee your tables will be logically consistent between databases. Tables in different databases may be dumped in completely different states.
-K, –disable-keys
/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and /*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output. This will make loading the data into a MySQL 4.0 server faster as the indexes are created after all data are inserted.
-n, –no-create-db
CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name; will not be put in the output. The above line will be added otherwise, if a –databases or –all-databases option was given.
-t, –no-create-info
Don’t write table creation information (the CREATE TABLE statement).
-d, –no-data
Don’t write any row information for the table. This is very useful if you just want to get a dump of the structure for a table!
–opt
Same as –quick –add-drop-table –add-locks –extended-insert –lock-tables. Should give you the fastest possible dump for reading into a MySQL server.
-pyour_pass, –password[=your_pass]
The password to use when connecting to the server. If you specify no `=your_pass’ part, mysqldump you will be prompted for a password.
-P port_num, –port=port_num
The TCP/IP port number to use for connecting to a host. (This is used for connections to hosts other than localhost, for which Unix sockets are used.)
-q, –quick
Don’t buffer query, dump directly to stdout. Uses mysql_use_result() to do this. -Q, –quote-names
Quote table and column names within “’ characters.
-r, –result-file=…
Direct output to a given file. This option should be used in MSDOS, because it prevents new line `\n’ from being converted to `\n\r’ (new line + carriage return).
–single-transaction
This option issues a BEGIN SQL command before dumping data from server. It is mostly useful with InnoDB tables and READ_COMMITTED transaction isolation level, as in this mode it will dump the consistent state of the database at the time then BEGIN was issued without blocking any applications. When using this option you should keep in mind that only transactional tables will be dumped in a consistent state, e.g., any MyISAM or HEAP tables dumped while using this option may still change state. The –single-transaction option was added in version 4.0.2. This option is mutually exclusive with the –lock-tables option as LOCK TABLES already commits a previous transaction internally.
-S /path/to/socket, –socket=/path/to/socket
The socket file to use when connecting to localhost (which is the default host).
–tables
Overrides option –databases (-cool.gif.
-T, –tab=path-to-some-directory
Creates a table_name.sql file, that contains the SQL CREATE commands, and a table_name.txt file, that contains the data, for each give table. The format of the `.txt’ file is made according to the –fields-xxx and –lines–xxx options. Note: This option only works if mysqldump is run on the same machine as the mysqld daemon, and the user/group that mysqld is running as (normally user mysql, group mysql) needs to have permission to create/write a file at the location you specify. -u user_name, –user=user_name
The MySQL user name to use when connecting to the server. The default value is your Unix login name.
-O var=option, –set-variable var=option
Set the value of a variable. The possible variables are listed below. Please note that –set-variable is deprecated since MySQL 4.0, just use –var=option on its own.
-v, –verbose
Verbose mode. Print out more information on what the program does.
-V, –version
Print version information and exit.
-w, –where=’where-condition’
Dump only selected records. Note that quotes are mandatory:
-X, –xml
Dumps a database as well formed XML
-x, –first-slave
Locks all tables across all databases.
“–where=user=’jimf’” “-wuserid>1″ “-wuserid backup-file.sql
You can read this back into MySQL with:
Code:
mysql database my_databases.sql
If all the databases are wanted, one can use:
Code:
mysqldump –all-databases > all_databases.sql

Mysql Database Import and Backup
Code:
Import database backup
./mysql -uUserName -pPassword DatabaseName /s/domainname.com/httpdocs/databasename.sql

Backup Table
./mysqldump -uUserName -pPassword DatabaseName TableName > /s/domainname.com/httpdocs/databasename.sql

Comments Off    Read More   
Nov
28
PLease go to /home/username/.spamassassin#pico /home/wwwmfm/.spamassassin/user_prefs

required_hits 1
rewrite_subject 1
rewrite_header Subject *****SPAM*****

Comments Off    Read More   

Included with the Webmin distribution is a program called changepass.pl to solve precisely this problem. Assuming you have installed Webmin in /usr/local/webmin-1.090, you could change the password of the admin user to foo by running
/usr/local/webmin-1.090/changepass.pl /etc/webmin admin foo

Comments Off    Read More   
Deleted files recovery howto
Undeleting files on the Linux ext2 filesysten with debugfs and e2undel
written by Oliver Diedrich (e2undel@users.sourceforge.net)This text describes the steps needed do recover the data of a file that was recently deleted. It is neither a complete usage instruction for the e2undel and debugfs tools nor does it explain the backgrounds of file undeletion on the ext2 filesystem.

The first steps
First of all: Immediately unmount the file system the deleted file was located on. This minimizes the risk that the data of the deleted file are overwritten while taking steps to recover them. All data written to the file system containing the deleted file – either by you or by any other process running on your machine – might overwrite some of the data you want to recover!

If you can’t unmount the file system, e.g. because the deleted file was located on your root file system, you should consider to shut down the computer, remove the hard drive and put it into another Linux machine. Probably, you will have to compile and install some software, such possibly destroying the data you want to recover.

I strongly suggest this option if either the deleted data are so important that you don’t want to take any unnecessary risk to loose them, or if the file system has very few unused space available (less then 20 percent or less than 100 MByte), or if the file is larger than 48 kByte: If few free space is available on the file system, ext2 might choose to store new data in areas that were recently used by deleted files; and if the file is larger than 48 kBytes, its data may be distributed across the file system, such enhancing the risk of overwriting parts of the deleted data with new files. It is your decision; but you have been warned.

If you are in the very unpleasant situation that you neither can use your system without the file system containing the deleted file nor have another Linux machine available, I strongly suggest to create a RAM disk to build and install the necessary software. With kernel 2.4, it is quite easy: Just do a mount tmpfs /mnt -t tmpfs. This will create a dynamically growing RAM disk on directory /mnt.

Using debugfs
Especially if you can’t unmount the file system containing the deleted data, debugfs is a less comfortable, but usable alternative if it is already installed on your system. (If you have to install it, you can use the more comfortable e2undel as well.) Just try a

/sbin/debugfs device
Replace device by your file system, e.g. /dev/hda1 for the first partition on your first IDE drive. At the “debugfs:” prompt, enter the command
lsdel
After some time, you will be presented a list of deleted files. You must identify the file you want to recover by its owner (2nd column), size (4th column), and deletion date. When found, you can write the data of the file via
dump filename
The inode_number is printed in the 1st column of the “lsdel” command. The file filename should reside on a different file system than the one you opened with debugfs. This might be another partition, a RAM disk or even a floppy disk.

Repeat the “dump” command for all files that you want to recover; then quit debugfs by entering “q”.

Using e2undel
e2undel works in a similar way, using the same deleted file detection routines, but provides a somewhat friendlier user interface and some additional help to identify the files you want to recover.

Building e2undel
Download the sources from sourceforge.net/projects/e2undel. Don’t save the tgz file found there on the file system with the deleted file! (You should have unmounted it, do you remember?) Use a different file system or a RAM disk.

Now build e2undel: Untar the tgz file (tar xzf e2undel-nnn.tgz), change to the resulting e2undel directory, and do a simple make in that directory. If erverything works fine, this will result in an executable e2undel binary. Again, even if it annoys you, this old warning about file systems containing deleted files that are not unmounted (just skip to the next paragraph if you are not concerned): Building the program will create some object files in the e2undel directory and some temporary compiler files in /tmp. Each of these files could overwrite the data you want to recover…

If the compiler complains about missing header files or unknown variable types, you probably lack the e2fsprogs include files. They usually are included in your Linux distribution, hidden in a package named e2fsprogs-devel, ext2fs-devel or something similar. Simply install this package from your distribution, or from the web. Attention: This rpm will install a lot of files in your /usr file system.

If this does not not work for you not or your system is not rpm based, you have to download the source code of Ted Ts’o’s Ext2 Filesystem Utilities, untar the tgz file, build and install at least the ext2fs library contained within, and change the path to the ext2 related header files in e2undel’s e2undel.h file. Attention: Just the tgz file contains about 1000 files, summing up to 6 MByte (without even having started the compiler). If you have to install and build the ext2fs library on the file system containg your deleted file: This is the point you seriously should think about doing all the build stuff on another machine.

Starting e2undel
The synopsis of e2undel is

e2undel -d device -s path [-a] [-t]
-d: file system where to look for deleted files (e.g., /dev/hdb1 for the 1st partition on the 2nd IDE drive)
-s: directory where to save undeleted files
-a: work on all files, not only on those listed in undel log file
-t: try to determine type of deleted files w/o names, works only with -a

The -a option always must be given in your situation, and the -t option will help you a lot in finding the files you want to recover.

An example
Suppose, your system uses two partitions, one (let’s say, /dev/hdb5) is mounted on /, the other one (let’s say, /dev/hdb6) is mounted on /home. You as user foo just deleted a file in your home directory and noticed your error. You have logged out, logged in as root and unmounted the /home partition.

e2undel -d /dev/hdb6 -s /tmp -a -t
will scan your home partition for deleted files, and present you a table like this:
user name | 1

Comments Off    Read More   
Nov
27
Posted on 27-11-2006

hackers. So friends following are some of the tips which will help to manage the kernel security through /proc pseudo-filesystem, Quite a few files /proc/sys are directly related to security. The parameter just need to have a flag(boolean value) set.Enabled if contains a 1 and disables if contains 0 , Many of the options are under /proc/sys/net/ipv4

Such as ..

icmp_echo_ignore_all : Ignore all ICMP ECHO requests ( Ping Request)

ip_forward : Enables or disables the forwarding of IP packets between interfaces depending on the kernel is configured as a host or router.

For example just take a look at this command.

echo “0″ > /proc/sys/net/ipv4/icmp_echo_ignore_all

The above command will deny all the ping request on the server.

The command sysctl -A will show the kernel configuration parameters set on the server, Basically the command reads the configuation file /etc/sysctl.conf after each reboot.

Comments Off    Read More   
Add these Lines under httpd.conf file
========================ServerAdmin webmaster@secure.avmdvds.com
DocumentRoot /home/securea/public_html
BytesLog domlogs/secure.avmdvds.com-bytes_log
ServerName www.secure.avmdvds.com
ScriptAlias /cgi-bin/ /home/securea/public_html/cgi-bin/
CustomLog /usr/local/apache/domlogs/secure.avmdvds.com-ssl_log “%t %{version}c %{cipher}c %{clientcert}c”
User securea
Group securea
SSLEnable
SSLCertificateFile /usr/share/ssl/certs/secure.avmdvds.com.crt
SSLCertificateKeyFile /usr/share/ssl/private/secure.avmdvds.com.key
SSLLogFile /var/log/secure.avmdvds.com
UserDir public_html
SetEnvIf User-Agent “.*MSIE.*” nokeepalive ssl-unclean-shutdown

========================

#service httpd stop
#service httpd startssl

Comments Off    Read More   
SSL –cd /usr/share/ssl/CA/
Go to certificate issuer web site (here as example — comodo )
wget http://instantssl.com/ssl-certificate-supp…yServicesCA.crt
pico /usr/local/apache/conf/httpd.conf
Add line –
SSLCACertificateFile /usr/share/ssl/CA/ComodoSecurityServicesCA.crtIf its Freessl.com then look out for CA certifiacate at –
http://www.freessl.com/chainedssl/chaineds…nstallcert.html
Comments Off    Read More   

Disk Quota Check

If you are getting following errors in your logs :

Sep 5 21:51:43 srv01 kernel: VFS: find_free_dqentry(): Data block full but it shouldn’t.
Sep 5 21:51:43 srv01 kernel: VFS: Error -5 occured while creating quota.
Sep 5 21:51:43 srv01 kernel: VFS: find_free_dqentry(): Data block full but it shouldn’t.
Sep 5 21:51:43 srv01 kernel: VFS: Error -5 occured while creating quota.

then you need to update your quota on ensim :

root@ensim root]# quotaoff -av
/dev/hda3 [/]: group quotas turned off
/dev/hda3 [/]: user quotas turned off
[root@ensim root]# cd /
[root@ensim /]# ls
aquota.group bin dev home initrd lost+found mnt proc sbin
usr
aquota.user boot etc htdocs.tgz lib misc opt root tmp
var
[root@ensim /]# rm aquota.*
rm: remove `aquota.group? y
rm: remove `aquota.user? y
[root@ensim /]# ls
bin boot dev etc home htdocs.tgz initrd lib lost+found misc mnt
opt proc root sbin tmp usr var
[root@ensim /]# quotacheck -agiuv
Cannot remount filesystem mounted on / read-only. Counted values might not
be right.
Should I continue [n]: y
quotacheck: Scanning /dev/hda3 [/] done
quotacheck: Checked 13987 directories and 135025 files
[root@ensim /]# quotaon -av
/dev/hda3 [/]: group quotas turned on
/dev/hda3 [/]: user quotas turned on
[root@ensim /]#

Comments Off    Read More