Wednesday, April 27, 2011

Setup mobile broadband on linux


Setup mobile broadband on linux

I am using sony ericsson k790i with Aircel(India) connection. To setup mobile broadband on my linux (BackTrack 4) laptop, i done following steps.

Step1. I plugged my mobile to my laptop (using usb data cable).
Step2. I issued command wvdialconf which detected usb modem of my mobile and created conf file /etc/wvdial.conf
         root# wvdialconf
        root# more /etc/wvdial.conf
Step3. I edited /etc/wvdial.conf and ensure following entries in file. You may found most of entries already present in file.
           root# vi /etc/wvdial.conf
               [Dialer Defaults]
                    Init1  = ATZ
                    Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
                    Init3= AT+CGCDONT=1,"IP","aircelgprs","",0,0
                    Modem Type= USB Modem
                    Phone = *99#
                    ISDN = 0
                    Stupid Mode=1
                    Password = blank
                    New PPPD = yes
                    Username = blank
                    Modem = /dev/ttyACM0
                    FlowControl=NOFLOW
                    Baud = 460800

(Remember that aircelgprs is my APN and username and password is blank)

Step4. Now issue command wvdial and after few messages my laptop get connected to internet.

Get Size of IP Routing cache


Get Size of IP Routing cache

To get the size of IP Routing Cache we can use following command
root# dmesg | grep -i 'IP route cache'
IP route cache hash table ....

To edit routing table size we can use kernel parameter
rhash_entries=' size in bytes'

Recover LVM from Corrupted physical volume

I had Volume Group /dev/vg1 that consist two physical volumes /dev/sdb1 and /dev/sdc1 . One of physical volume /dev/sdc1, corrupted due to disk problem , now the challenge was to recover LVM. I decided to use pvremove command, in following way
    root#pvremove /dev/sdc1
Above command displayed error couldn't find device uuid 'xxxxxxx'
Then issue tried forcefully
   root#pvremove -ff /dev/sdc1 
After some warning, it removed that physical volume.
Then i issued pvdisplay command
 root#pvdisplay
This display message  ' Couldn't find device with uuid xxxxxx'

Now what you need to do is to create a physical volume with new disk with missing uuid .
For that following command can be used

root# pvcreate --uuid=xxxxxx /dev/sdd1 --restorefile=/etc/lvm/archive/vg0_0.vg
Where /dev/sdd1 is new hard disk in replace of /dev/sdc1
Then restore the vg metadata with following command
root# vgcfgrestore -f /etc/lvm/archive/vg0_0.vg tvg0
Note: check archive of vg in /etc/lvm/archive

Bad Sector on Hard Disk


Bad Sector on Hard Disk

Modern disk map bad sector to good sector to avoid any sort of error due to bad sector. If a large number of sector mapped to another sectors that means disk is going to fail
 smartctl command is very helpful command to diagnose disk related problems

To instruct for selftest , we can issue following command
 root# smartctl -l selftest /dev/sda

To get attributes list you can use following command
 root#smartctl -A /dev/sda

The output of above command is self explanatory and help you to recognize if there is any problem on hard disk.

Incremental Backup using tar


Incremental Backup using tar

GNU tar currently provide following options to handle incremental backup

 --listed-incremental=snapshot file (-g snapshot file)
         --incremental (-G)

Examples
   root# tar --create --file=archive1.tar listed-incremental=/var/log/usr.snar /usr

Above given command will create archive1.tar as incremental backup of /usr filesystem, additional metadata will stored in file /var/log/usr.snar file . If /var/log/usr.snar file not exist it will get created, the created archive will then level 0 backup.
Now suppose for the same above given example, if /var/log/usr.snar exist. Then above given will check which files get modified and only those files stored in archive, so that will be level 1 backup.

So the best option is take level 0 (full) backup first as following 
root# tar --create --file archive1.tar --listed-incremental=/var/log/usr.snar
copy that file 
root#cp /var/log/usr.snar /var/log/usr.snar-1
Then take incremental backup as follows 
root#tar --create --file archive2.tar --listed-incremental=/var/log/usr.snar

To extract content from backup we also have to follow same steps which followed at the time of backup. In our example the procedure will be as follows
root# tar --extract --listed-incremental=/dev/null --file=archive1.tar
Followed by
root#tar --extract --listed-incremental=/dev/null --file=archive2.tar

Can't umount on RHEL/CENTOS Error: device is busy


Can't umount on RHEL/CENTOS Error: device is busy

[root@sandbox1 ~]# umount /dev/sdb1
umount: /mnt/pen: device is busy
umount: /mnt/pen: device is busy

Solution :

[root@sandbox1 ~]# lsof | grep /mnt/pen
esd       23711   root  cwd       DIR       8,17      4096    1228794 /mnt/pen/720p BRRip x264 - HDMiCRO by Mr. KickASS
esd       23711   root    3r      REG       8,17 942758269    1229005 /mnt/pen/ - HDMiCRO by Mr. KickASS/ Mr. KickASS.mp4

[root@sandbox1 ~]# kill -9 23711


[root@sandbox1 ~]# umount /dev/sdb1

Done.

How to install Zend Optimizer with Ioncube Loader on plesk


How to install Zend Optimizer with Ioncube Loader on plesk


Many users wanted to install these addon php modules to the Plesk VPS configurations.Please go thorugh the following instaructions:

Login to server as root

Run:
# wget -q -O – http://www.atomicorp.com/installers/atomic.sh | sh

This will download, and setup the atomic yum channel for you.
During this, you will be asked if you wish to “add the Plesk yum repository to the system?”. You must answer Yes to this, by press y and then pressing enter. You will also be asked for which version of Plesk – it is STRONGLY recommended to use plesk 8.

You now have everything you need to install Zend Optimizer and Ioncube easily. Run the following command:

# yum install php-zend-optimizer php-ioncube-loader
Press “Y”

You now have everything installed, Now restart the apache

# /etc/init.d/httpd restart

And these will now be available to any php application using its features.

/tmp 100% full


/tmp 100% full

 Even though we have cleared the unwanted files but still /tmp is 100% full.

Here is why it happens.

If you delete files and they don’t go from df -h disk status then you’ve deleted files that are open by processes. You will have to restart whichever processes had those files were open in the first place, typically httpd or mysql.

lsof | grep /tmp

you will get the result as below(for example)

httpd 30070 nobody 1975u REG 7,0 0 11 /tmp/ZCUDMmgQDr (deleted)
httpd 30100 nobody 1975u REG 7,0 0 11 /tmp/ZCUDMmgQDr (deleted)
mysqld 7290 mysql 5u REG 7,0 1089 29 /tmp/ibYfnGNC (deleted)
mysqld 7290 mysql 6u REG 7,0 0 30 /tmp/ibgA9zfB (deleted)

kill httpd and mysql or whaterver process it shows that will fix the problem. I hope you all know the command to kill httpd or mysql.

killall -e -9 httpd or service httpd stop

Then restart apache(httpd)

How to enable Mysql 3306 port for a particular IP and deny for all?


How to enable Mysql 3306 port for a particular IP and deny for all?


If you want to disable the Mysql Access for all IPs except your ip then follow the below steps :

root@server[#] vi /etc/csf/csf.conf

Then search for the line :
# Allow incoming TCP ports
and the remove the port : 3306

and also search for the line :

# Allow outgoing TCP ports
and remove the port : 3306

Save and Quit.

then open the csf.allow file

root@server[#] vi /etc/csf/csf.allow
and add the entry as :

tcp:in:d=3306:s=10.10.10.10


And then restart the CSF service

root@server[#] csf -r

Note : Replace 10.10.10.10 with the IP for which you want to Allow access.

That’s all you are done.

Linux server change or setup the timezone


Linux server change or setup the timezone

Set timezone using /etc/localtime configuration file [any Linux distro]

Often /etc/localtime is a symlink to the file localtime or to the correct time zone file in the system time zone directory.

Generic procedure to change timezone

Change directory to /etc
# cd /etc

Create a symlink to file localtime:
# ln -sf /usr/share/zoneinfo/EST localtime

OR some distro use /usr/share/zoneinfo/dirname/zonefile format (Red hat and friends)
# ln -sf /usr/share/zoneinfo/EST localtime

OR if you want to set up it to IST (Asia/Calcutta):
# ln -sf /usr/share/zoneinfo/Asia/Calcutta localtime

Please mote that in above example you need to use directory structure i.e. if you want to set the timezone to Calcutta (India) which is located in the Asia directory you will then have to setup using as above.

Use date command to verify that your timezone is changed:
$ date

Output:

Tue Aug 27 14:46:08 EST 2006


Use of environment variable

You can use TZ environment variable to display date and time according to your timezone:
$ export TZ=America/Los_Angeles
$ date

Sample Output:

Thu Aug 27 11:10:08 PST 2006

How to disable ping… in Linux servers


How to disable ping… in Linux servers

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all

Or add the line

net.ipv4.conf.icmp_echo_ignore_all = 1
in /etc/sysclt.conf

To re-enable ping
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all

Or add the line
net.ipv4.conf.icmp_echo_ignore_all = 0
in /etc/sysclt.conf

Alternatively, we can use IPtables to disable ping
# iptables -A INPUT -p icmp -j DROP

How to secure /tmp


How to secure /tmp

The /tmp folder on Linux system is most commonly used by hackers to upload malicious script and execute code to make mass replacement or modification. The reason is this is well known path for world writable folder (for sessions and temporary files which anyone can have write access to).
You can secure this threat to some extent by properly security the /tmp of your servers.
First of all do not use /tmp as simply a folder on / partition.

Create the separate partition for /tmp during setup of your server itself (while OS installation).

If you have already partitioned the system with default layout and there is no free blocks left on your hard drive for new partition then create Virtual Disk. and mount it on /tmp

You can use following options while mounting /tmp

noexec,nosuid,nodev,bind

noexec = This mount option do not allow execution of any script (shell / bash / perl etc..) in /tmp
nosuid = special userID or Group ID will not take any effect. The files upload will not execute by the owners / group owners permissions.
nodev = Thi will not interpret character or block special devices on the file system mounted with this iption.
bind = Remount a subtree somewhere else (so that its contents are available in both places)

so you can use following command to mount temp partition.

mount -t ext3 -o rw,nosuid,nodev,noexec /dev/sda6 /tmp

if you have virtual file system use following.

mount -t ext3 -o loop,defaults,rw,nosuid,nodev,noexec /var/TempFS /tmp

/var/TempFS is the file name which has virtual file system.

also add / edit the /etc/fstab for /tmp partition mount option.

/dev/sda6 /tmp ext3 rw,noexec,nosuid,nodev,bind 0 0
/tmp /var/tmp none rw,noexec,nosuid,nodev,bind 0 0

Configuring iptables Firewall on Linux Server


Configuring iptables Firewall on Linux Server

Configuring Firewall on Linux Server

By default you get redhat default firewall rules on Linux machine. In order to secure your Linux server you have to block all unnecessary ports and also you need to allow access to specific service on specific IP.

For example you have several IP's on server and several services running on the same server.You want some services to accept connections on particular IP's only. You can achieve this with the iptables firewall.

Following are few examples for the same.

Here, 192.168.1.1 is your server main IP192.168.1.2 is the additional IP on the same server.

# To allow SSH to accept connection on 192.168.1.1 IP only.

iptables -A INPUT -p tcp -d 192.168.1.1 --dport 22 -j ACCEPT

# To allow SSH to accept connection on 192.168.1.1 IP from 192.168.1.254 IP (your remote machine IP) only.

iptables -A INPUT -p tcp -d 192.168.1.1 -s 192.168.1.154 --dport 22 -j ACCEPT

# To allow / accept tcp connection to all other services (except ssh) on 192.168.1.2

iptables -A INPUT -p tcp -d 192.168.1.2 -m multiport --dport 20,21,25,53,80,443,110,143,465,953,993,995,8080 -j ACCEPT

# To accept udp connections for named and rndc services on 192.168.1.2

iptables -A INPUT -p udp -d 192.168.1.2 -m multiport --dport 53,953 -j ACCEPT

# To accept ping request on server (both ip's)

iptables -A INPUT -p icmp -j ACCEPT

# To drop the all other connections except above services on above ports specified.

iptables -A INPUT -j DROP

You can make combination of majaor protocol suite (TCP , UDP , ICMP) source IP , destination IP , source port and destination port and can optimize your server firewall to any extent you want.

The Source port may vary for every connection (request) to the same service so i have not used in above examples.

Further always change the SSH Port from /etc/ssh/sshd_config file open the same in firewall for your personal use.

Following is the most essential ports need to be open.

20 ftp-data
21 ftp
22 ssh
25 smtp
53 domain
80 http
110 pop3
143 imap
443 https
465 smtps
953 rndc
993 imaps
995 pop3s
3306 mysql

2082 cpanel
2083 secure cpanel
2086 whm
2087 secure whm
2077 webdisk
2078 secure webdisk
2095 webmail
2096 secure webmalil

8880 plesk panel
8443 secure plesk panel

Steps to configure firewall.

Save your old firewall configuration "/etc/sysconfig/iptables-config" to some other file and flush the firewall.

mv /etc/sysconfig/iptables-config /etc/sysconfig/iptables-config_old

iptables -F

service iptables save

iptables -A INPUT -p tcp -d 192.168.1.1 --dport 22 -j ACCEPT

iptables -A INPUT -p tcp -d 192.168.1.1 -s 192.168.1.154 --dport 22 -j ACCEPT

iptables -A INPUT -p tcp -d 192.168.1.2 -m multiport --dport 20,21,25,53,80,443,110,143,465,953,993,995 -j ACCEPT

iptables -A INPUT -p udp -d 192.168.1.2 -m multiport --dport 53,953 -j ACCEPT

iptables -A INPUT -p icmp -j ACCEPT

iptables -A INPUT -j DROP

service iptables save

NOTE: please make sure you allow all the ports (specifically ssh port) before adding the last DROP or REJECT rule rule.

Apache Server SSL Certificate Installation


Apache Server SSL Certificate Installation

If you are installing an Extended Validation SSL Certificate, use our Apache EV SSL Certificate Installation Instructions. If you are installing any other certificate, follow the instructions below.
  1. Copy the Certificate files to your server.
    Download your Intermediate (DigiCertCA.crt) and Primary Certificate (your_domain_name.crt) files from your Customer Area, then copy them to the directory on your server where you will keep your certificate and key files. Make them readable by root only. 
  2. Find the Apache config file to edit.
    The location and name of this file can vary from server to server -- Especially if you use a special interface to manage your server configuration.
    Apache configuration files are typically found in /etc/httpd. The main configuration file is usually named httpd.conf. In some cases the <VirtualHost> blocks will be at the bottom of this httpd.conf file. Sometimes you will find the <VirtualHost> blocks in their own files under a directory like /etc/httpd/vhosts.d/ or /etc/httpd/sites/ or in a file called ssl.conf.
    If you open the file with a text editor, you should be able to find <VirtualHost> blocks which contain Apache settings. 
  3. Identify the SSL <VirtualHost> block to configure.
    If you need your site to be accessible through both secure (https) and non-secure (http) connections, you will need a virtual host for each type of connection. Make a copy of the existing non-secure virtual host and configure it for SSL as described in step 4.
    If you only need your site to be accessed securely, configure the existing virtual host for SSL as described in step 4. 
  4. Configure the <VirtualHost> block for the SSL-enabled site.
    Below is a very simple example of a virtual host configured for SSL. The parts listed in bold are the parts that must be added for SSL configuration:
    <VirtualHost 192.168.0.1:443>
    DocumentRoot /var/www/html2
    ServerName www.yourdomain.com
    SSLEngine on
    SSLCertificateFile /path/to/your_domain_name.crt
    SSLCertificateKeyFile /path/to/your_private.key
    SSLCertificateChainFile /path/to/DigiCertCA.crt

    </VirtualHost>
    Adjust the file names to match your certificate files:
    • SSLCertificateFile should be your DigiCert certificate file (eg. your_domain_name.crt).
    • SSLCertificateKeyFile should be the key file generated when you created the CSR.
    • SSLCertificateChainFile should be the DigiCert intermediate certificate file (DigiCertCA.crt) If the SSLCertificateChainFile directive does not work, try using the SSLCACertificateFile directive instead.
  5. Test your Apache config before restarting.
    It is always best to check your Apache config files for any errors before restarting, because Apache will not start again if your config files have syntax errors. Run the following command: (it is apache2ctl on some systems)
    apachectl configtest
  6. Restart Apache.
    You can use apachectl commands to stop and start Apache with SSL support:
    apachectl stop
    apachectl start 

    Note: If Apache does not start with SSL support, try using "apachectl startssl" instead of "apachectl start". If SSL support only loads with "apachectl startssl" we recommend you adjust the apache startup configuration to include SSL support in the regular "apachectl start" command. Otherwise your server may require that you manually restart Apache using "apachectl startssl" in the event of a server reboot. This usually involves removing the <IfDefine SSL> and </IfDefine> tags that enclose your SSL configuration.


    Check whether the SSL key and cert are maching
    ============================================
    openssl x509 -noout -modulus -in certificate.crt | openssl md5
     openssl rsa -noout -modulus -in keyfile.crt |openssl md

How to dump and restore mySQL databases


How to dump and restore mySQL databases

You can get mysql dump in .sql format, just read it:

Go to /var/lib/mysql:
# cd /var/lib/mysql
Search for the database that you want:
# ls -l grep database_name
Dump it:
# mysqldump database_name > database.sql
If you want to restore on the same or other server:
# cd /var/lib/mysql
Check the database name where you want to restore the mysqldump:
# ls -l grep db_name
#
 mysql database_name <>database.sql

How to block users from accessing your site based on their IP address


How to block users from accessing your site based on their IP address

Blocking users by IP address is pretty simple with .htaccess.

So here it is the example:

Order allow, deny
Deny from 192.168.0.10
Deny from 212.155.
Deny from 1.2.3.4  5.6.7.8 127.0.0.1
Allow from all


Let’s take a look at the code line by line:


The first line “Order allow, deny” tells the web server the “Order” in which the Allow and Deny directive will be evaluated. It simply says: Give access to all hosts that are not present in the Deny from list and are present in the Allow from list. With allow, deny order Allow list is looked up first and then the web server checks the deny from list. So as we have allow from all – all access is allowed. Then the allowed access is filtered based on the Deny lists. With allow,deny access is disabled by default.

If we change the order to “deny, allow” then all access is enabled by default and only users in the deny lists are blocked. However as the deny is being processed first allow directives will override any maching settings set in deny directives.
The default Apache order is deny,allow. So you can skip the first line in your .htaccess file if you do not need to change the order in which the Deny and Allow rules are being evaluated by the web server.

So to keep the .htaccess simple you can just use:


Deny from 192.168.0.10
Deny from 212.155.


Basically you can use such rules in your .htaccess file to block a particular user, or a network from accessing your site.

You can put several IP address in a Deny or Allow rule. For example:

 Deny from 1.2.3.4   5.6.7.9


The IP addresses must be separated by a space or tab.
You can put entire networks as


Deny from 212.155.

This will block all users which IP addresses start with 212.155


Or to block all access to your site:


Deny from all

And then add another line to enable access only for yourself:



Allow from 1.2.3.4

Where “1.2.3.4” should be replaced with your computer IP address.

Install PhpMyadmin


Install PhpMyadmin

Login as Root
# cd /var/www/html (Document root of Apache)
# tar -xzvf phpMyAdmin-3.3.7-english.tar.gz
# rm -rf phpMyAdmin-3.3.7-english.tar.gz
# mv phpMyAdmin-3.3.7-english phpmyadmin
# cd phpmyadmin
# cp config.sample.inc.php config.inc.php
# service httpd restart
You can test by open phpmyadmin by this link :
http://your.domain.com/phpmyadmin/ ( Eg : http://localhost/phpmyadmin)
Try to login as a mysql user.
Try to login as root, I got this error
#2002 Cannot log in to the MySQL server
Solution :
Reset Mysql root password
Retry after that.

Reset Mysql Root Password


1: Stop the MySQL server process.
# /etc/init.d/mysqld stop
2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password.
# mysqld_safe –skip-grant-tables &
3: Connect to mysql server as the root user.
# mysql -u root
4: Setup new mysql root account password i.e. reset mysql password.
mysql> use mysql;
mysql> update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit;
5: Exit and restart the MySQL server.
# /etc/init.d/mysqld stop
6: Start MySQL server and test it
# /etc/init.d/mysql start
# mysql -u root -p
Login with new root password

mysqladmin is a client for performing administrative operations. You can use it to check the server’s configuration and current status, to create and drop databases, and more.
Invoke mysqladmin like this:
shell> mysqladmin [options] command [command-arg] [command [command-arg]] …
Some of the commands take an argument following the command name.
* ping
Check whether the server is available.
#mysqladmin -u root -ppassword ping
mysqld is alive
* password new-password
Set a new password. This changes the password to new-password for the account that you use with mysqladmin
#mysqladmin -u root -ppassword password newpass

* reload
Reload the grant tables.
#mysqladmin -u root -ppassword reload
*refresh
Flush all tables and close and open log files.
#mysqladmin -u root -ppassword refresh
*shutdown
Stop the server.
#mysqladmin -u root -ppassword shutdown
*variables
Display the server system variables and their values.(max_connections,slow_query_log, etc etc)
#mysqladmin -u root -ppassword variables
or
#mysqladmin -u root -ppassword var
*version
Display version information from the server.
#mysqladmin -u root -ppassword version
mysqladmin  Ver 8.42 Distrib 5.1.45, for redhat-linux-gnu on i386
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 5.1.45
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 3 hours 37 min 8 sec
Threads: 1  Questions: 60  Slow queries: 0  Opens: 16  Flush tables: 2  Open tables: 0  Queries per second avg: 0.4
*status
Display a short server status message.
#mysqladmin -u root -ppassword status
or
#mysqladmin -u root -ppassword stat
Uptime: 12442  Threads: 1  Questions: 48  Slow queries: 0  Opens: 16  Flush tables: 2  Open tables: 0  Queries per second avg: 0.3
* processlist
Show a list of active server threads.
#mysqladmin -u root -ppassword processlist
or
#mysqladmin -u root -ppassword proc
+—-+——+———–+—-+———+——+——-+——————+
| Id | User | Host      | db | Command | Time | State | Info             |
+—-+——+———–+—-+———+——+——-+——————+
| 27 | root | localhost |    | Query   | 0    |       | show processlist |
+—-+——+———–+—-+———+——+——-+——————+
* Process list & status
#mysqladmin -u root -ppassword proc stat
+—-+——+———–+—-+———+——+——-+——————+
| Id | User | Host      | db | Command | Time | State | Info             |
+—-+——+———–+—-+———+——+——-+——————+
| 37 | root | localhost |    | Query   | 0    |       | show processlist |
+—-+——+———–+—-+———+——+——-+——————+
Uptime: 13133  Threads: 1  Questions: 62  Slow queries: 0  Opens: 16  Flush tables: 2  Open tables: 0  Queries per second avg: 0.4

Uptime – The number of seconds the MySQL server has been running.
Threads – The number of active threads (clients).
Questions – The number of questions (queries) from clients since the server was started.
Slow queries – The number of queries that have taken more than long_query_time seconds. See Section 5.2.5, “The Slow Query Log”.
Opens – The number of tables the server has opened.
Flush tables – The number of flush-*, refresh, and reload commands the server has executed.
Open tables – The number of tables that currently are open.
Memory in use – The amount of memory allocated directly by mysqld.
Maximum memory used – The maximum amount of memory allocated directly by mysqld.
* create db_name
Create a new database named  ”newdb”.
#mysqladmin -u root -ppassword create newdb
* debug
Tell the server to write debug information to the error log.
*drop db_name
Delete the database named  ”newdb” and all its tables.
# mysqladmin -u root -ppassword drop newdb
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.
Do you really want to drop the ‘newdb’ database [y/N] y
Database “newdb” dropped
* extended-status
Display the server status variables and their values.
# mysqladmin -u root -ppassword extended-status
or
# mysqladmin -u root -ppassword ex
* No: of threads connected
# mysqladmin -u root -ppassword ex | grep Threads_connected
| Threads_connected                 | 1        |
* flush-hosts
Flush all information in the host cache.
# mysqladmin -u root -ppassword flush-hosts
* flush-logs
Flush all logs.
# mysqladmin -u root -ppassword flush-logs
* flush-privileges
Reload the grant tables (same as reload).
# mysqladmin -u root -ppassword flush-privileges
* flush-status
Clear status variables.
mysqladmin -u root -ppassword flush-status
* flush-tables
Flush all tables.
mysqladmin -u root -ppassword flush-tables
* flush-threads
Flush the thread cache.
mysqladmin -u root -ppassword flush-threads
* kill id,id,…
Kill server threads. If multiple thread ID values are given, there must be no spaces in the list.
mysqladmin -u root -ppassword kill 19

While accessing the website after the domain transfer from one server to other we got this error.
Error is due to wrong DB_name or DB_user or DB_password in connect.php file. Error will gives the path of that file. We have to check these entries. If there is any wrong entries we have to correct that.
If the database of domain is newworld_db . But there is a wrong entry in connect.php file. If the name of old database is oldworld_db and username is oldworld_user. Check mysql users  in cpanel–>MySql . We can see all the Mysql users :
SELECT user FROM mysql.user; ———>> list all mysql DB users
mysql> select from mysql.users;
Give all the privilege to that mysql user. Try to login by using that username and password.
If all the data’s are under old DB , we have to migrate all the contents from old database to new. For that :
mysqldump “old DB name” > dump.sql ————>> Backup old DB to dump.sql
# mysqldump my_db > my_db.sql
mysql “new DB name ” < dump.sql ——–>> Restore DB from dump.sql
# mysql mynew_db < my_db.sql
New database will updated after this restore process. Make these changes and retry.
If you are running cPanel / WHM you can find in /scripts folder on your server a large number of scripts that you can use to manage your server. This list shows a description of each script.

adddns - Adds a DNS zone.
addfpmail - Add frontpage mail extensions to all domains without them.
addfpmail2 -Add frontpage mail extensions to all domains without them.
addnetmaskips - Add the netmask 255.255.255.0 to all IPs that have no netmask.
addnobodygrp - Adds the group nobody and activates security.
addpop - Add a Pop Account.
addservlets - Add JSP support to an account (requires tomcat).
addstatus - (Internal use never called by user).
adduser - Add a user to the system.
admin - Run WHM Lite.
apachelimits - Add rlimits to Apache
betaexim - Installs the latest version of exim.
biglogcheck - looks for logs nearing 2 gigabytes in size
bsdcryptoinstall - Installs crypto on FreeBSD.
bsdldconfig - Configures the proper lib directories in FreeBSD.
bsdpkgpingtest - Tests the connection speed for downloading FreeBSD packages.
buildbsdexpect - Install expect on FreeBSD.
buildeximconf - Rebuilds exim.conf.
buildpostgrebsd-dev - Installs postgresql on FreeBSD.
checkbadconf - Checks /usr/local/apache/conf/httpd.conf for bad users.
checkbsdgroups - Checks and repairs proftpd ownership on FreeBSD.
checkccompiler - Checks to make sure the C compiler works on your system.
checkfpkey - Checks for the FrontPage suid key
checkgd - Checks to see if GD is built.
checkinterchange - (Internal use).
checklibssl - Checks to make sure the proper libssl symlinks exist.
checkmaxclients - Checks to see if apache has reached the maximum clients allowed.
checkoldperl - Checks to see if the version of Perl on your system is old.
checkrsync - Checks to make sure rsync is up to date.
checksuexecpatch - Checks to see if mailman has been patched for suexec.
checksuspendpages - Checks to see if suspend pages are properly named.
checkup2date - Makes sure up2date is set up properly (RedHat)
checkyum - Makes sure yum is set up properly.
chkpaths - Makes sure /usr/sbin/chown has a symlink to /bin/chown
chownpublichtmls - Change ownership of all users web space to them, which is useful for converting to suexec. Files owned by nobody are deleted.
chpass - Change password.
ckillall - Allows you to kill a process (used like killall).
ckillall2 - Allows you to kill a process.
cleanbw - Cleans up old bandwidth logs.
cleandns8 - Clean up named.conf.
cleangd - Cleans up old GD installs and reinstalls GD
cleanmd5 - Fix CPAN md5 problems.
cleanmsglog - cleans exim's msglog
cleanupmysqlprivs - Cleans up improper mySQL privileges.
compilers - Disables the usage of compilers for unprivileged users.
convert2maildir - Converts mail from mbox to maildir format and installs courier impap and pop (cpimap is removed).
courierup - Updates/Installs Courier
cpbackup - Runs backups.
distupgrade - Upgrades RedHat to the newest version (for testing only)
dnscluster - Enables DNS clustering.
dnsqueuecron - Adds a cron job to dump the DNS queue.
dnstransfer - Only if the server has a DNS master (sync with DNS master).
downgradefp - Downgrades FrontPage Extensions (to 5.0-0)
dropmysqldb - Drops a mySQL database.
easyapache - Upgrade Apache
editquota - Change a users quota.
enablechkservdwebmail - Enable service checking of webmaild.
enablefileprotect - Protects home directories if file protection is built in apache.
ensurepkg - Installs a FreeBSD package.
ensurerpm - Installs a rpm.
exim3 - Installs exim 3.
exim4 - Installs exim 4.
exim4-rh73test - Installs exim release #260. (RedHat only)
eximcron - Creates a cron job for exim_tidy_db.
eximlocalsend - Enables/Disables exim local sending.
exim_tidydb - Cleans the exim message log.
eximup - Installs/Updates exim.
fetchgd - Includes libg.so.
findhacks - Search for common Trojan Horses.
findoddrootprocesses - Lists root processes that may need to be checked out.
findphpversion - Check to see if your php version file is up to date.
findtrojans - Exhaustive Trojan Horse search.
fixallcartswithsuexec - Fixes permissions on carts when using suexec.
fixallinterchangeperm - Fixes permissions on all users' Interchange Shopping Carts.
fixbinpath - Makes sure all bin file paths are correct.
fixbuggynamed - Updates bind to solve any problems with bugs.
fixcommonproblems - Attempt to fix the most common problems.
fixetchosts - Fixes problems with /etc/hosts
fixeverything - Fix common problems and quotas.
fixfpwml - Fix for .wml errors with frontpage.
fixheaders - Run if nothing compiles errors with .h files on compile.
fixinterchange - Reinstall interchange Perl modules.
fixinterchangeperm - fix permissions on a user's interchange cart.
fixipsnm - Same as addnetmask ips, but Perl though.
fixlibnet - Reinstall Bundle::libnet (Perl).
fixlocalhostwithphp - Change /etc/hosts to work better with PHP 4.2.0 + MySQL.
fixmailman - Updates and restarts mailman.
fixmailmanwithsuexec -
fixmuse - Reinstalls muse.
fixmysql - Fixes problems with mySQL.
fixmysqlbsd - Fixes problesm with mySQL on FreeBSD.
fixnamed - Updates bind to handle many DNS zones (more than 512).
fixndc - Repair redhat's broken named.conf on 7.2.
fixoldlistswithsuexec - Run after enabling suexec on the server to change the URLs that Mailman gives out to ones that don't give a 500 internal server error.
fixperl - Symlink /usr/local/bin/perl /usr/bin/perl.
fixperlscript - Makes sure a perlscript includes all corresponding modules.
fixpop - Fix a POP account and reset password.
fixproftpdconf - Fixes problems with /usr/local/etc/proftpd.conf
fixproftpddupes - Updates proftpd.
fixquotas - Fix quotas.
fixrndc - Fixes named.conf to prevent rndc staus failed.
fixspamassassinfailedupdate - Reinstalls a failed spamassassin update.
fixsubdomainlogs - Run if subdomain logs don't show up in cPanel.
fixsuexeccgiscripts - Fix CGI scripts that are broken after suexec installed.
fixvaliases - Fix permisions on valiases.
fixwebalizer - Repair a Webalizer that has stopped updating.
fp3 - Updates the fpexe3 patch.
fpanonuserpatch - Updates FrontPage extensions to include the anonymous user patch.
ftpcheck - Checks for FTPSSL.
ftpquaotacheck - Runs quota checking for all ftp users.
ftpup - Updates your ftp server.
fullhordereset - Resets Horde and displays the current Horde password.
futexfix - Fixes problesm with futex.
futexstartup - Starts futex.
gcc3 - Installs gcc-3.3.3
gencrt - Generate a .crt and .csr file.
grpck - Checks to see if grpck is working properly.
hdparmify - Enable dma/irq/32bit HD access, which speeds up IDE drives.
hdparmon - Turns on hdparm.
initacls - Mounts your file systems with ACL support (make sure your kernel supports ACLs)
initfpsuexec - Enable FrontPage suexec support.
initquotas - Turn on quota support on new drives.
initsslhttpd - Make sure HTTP starts with SSL.
initsuexec - Turn on suexec support if suexec is installed.
installcgipm - Installs CGI.pm
installdbi - Install Bundle::DBD::mysql.
installfpfreebsd - Installs FrontPage 5 Extensions on FreeBSD.
installfpgentoo - Installs FrontPage on Gentoo.
installgd - Builds GD.
installpkg - Installs a FreeBSD package.
installpostgres - Installs PostrgeSQL.
installrpm - Installs a rpm.
installspam - Install SpamAssassin.
installssl - Add a SSL vhost.
installzendopt - Install zend optimzer.
installzendopt-freebsd - Install zend optimizer on a freebsd machine.
isdedicatedip - Checks an ip to see if it is dedicated.
killacct - Delete an account.
killbadrpms - Security script that kills insecure RPMs from the server.
killdns - Delete a DNS zone.
killdrrootvhost - Removes the document root for a virtual host.
killndbm - Remove the broken NDBM_File module from 7.2.
killpvhost - Removes a virtual host from proftpd.conf.
killspamkeys - Removes a spam key.
killsslvhost - Removes a SSL entry for a virtual host.
killvhost - Delete a vhost.
listcheck - Checks mailing lists for issues.
listproblems - Lists common problems.
listsubdomains - List subdomains.
mailperm - Fix almost any mail permission problem.
mailscannerupdate - Updates MailScanner
mailtroubleshoot - Guided mail fix.
makecpphp - Installs php.
makesecondary - Part of DNS transfer.
manualupcp - Updates cPanel manually.
md5crypt - Encrypts a password into MD5.
mseclocal - Sets up Mandrake's msec to allow exim to run as mailnull.
mysqladduserdb - Create a MySQL databse and user.
mysqlconnectioncheck - Attempts to connect to MySQL, restarts SQL if necessary.
mysqldeluserdb - Delete a MySQL database and user.
mysqlpasswd - Change MySQL password.
mysqlrpmpingtest - Checks your connection speed for downloading mySQL rpms.
mysqlup - Updates mySQL.
ndbmcheck - Checks to see if the nbdm module is loaded (kills in RedHat 7.2)
netftpsslpatch - Patches FTPSSL.pm.
newexim - Installs the latest version of exim.
nofsck - Make fsck always use -y
nomodattach - Removes mod_attach from httpd.conf.
nomodauthmysql -Removes mod_auth_mysql from httpd.conf.
nomodbwprotect - Removes mod_bwportect from httpd.conf.
nomodgzipconfmods - Removes mod_gzip from httpd.conf.
nomodperl - Removes mod_perl from httpd.conf.
oldaddoncgi2xaddon - Updates old addons to X addons.
park - Parks a domain.
patcheximconf - Fixes exim.conf.
perlinstaller - Installs perl.
phpini - Create a php.ini file.
pingtest - Checks your download time from cPanel mirrors.
pkgaccount-ala - backs up an Alab*nza account for transfer.
pkgacct-ciXost - backs up a ci*ost account for transfer.
pkgacct-dXm - backs up a d*m account for transfer.
pkgacct-enXim - backs up an en*im account for transfer.
pkgacct-pXa - backs up a p*a account for transfer.
proftpd128 - Installs proftpd-1.2.8.
ptycheck - Fixes permissoins on /dev/ptmx.
pwck -Verifies the integrity of system authentication information.
quickkernel - Updates your kernel.
quicksecure - Quickly kill useless services.
rebuildcpanelsslcrt - Rebuilds the cPanel SSL Certificate.
rebuildcpusers - Rebuilds /var/cpanel/users.
rebuildetcpasswd - Rebuilds /etc/passwd.
rebuildeximbsd - Rebuilds exim on FreeBSD.
rebuildhttpdconffromproftpd - Rebuild httpd.conf from the proftpd.conf file.
rebuildinterchangecfg - Used after moving a domain with Interchange to the server.
rebuildnamedconf - Restore named.conf from files in /var/named.
rebuildproftpd - Restore proftpd.conf from httpd.conf.
reinstallmailman - Reinstalls mailman.
relocatevartousr - Relocates files from /var to /usr in case of disk space issues.
remdefssl - Remove default SSL vhost.
reseteximtodefaults - Resets exim's default settings.
resetimappasswds - Resets all imap passwords.
resetquotas - Change quotas to what they should be .
restartsrv - Restart a service.
restartsrv_apache - Restart apache.
restartsrv_bind - Restart bind.
restartsrv_clamd - Restart clamd.
restartsrv_courier - Restart courier imap.
restartsrv_cppop - Restart cppop.
restartsrv_entropychat - Restart entropy chat.
restartsrv_exim - Restart exim.
restartsrv_eximstats - Restart exim statistics.
restartsrv_ftpserver - Restart your ftp server.
restartsrv_httpd - Restart httpd.
restartsrv_imap - Restart impad.
restartsrv_inetd - Restart inetd.
restartsrv_interchange - Restart Interchange Shopping Cart.
restartsrv_melange - Restart melange chat.
restartsrv_mysql - Restart mysqld.
restartsrv_named - Restart named.
restartsrv_postgres - Restart postgresql.
restartsrv_postgresql - Restart postgresql.
restartsrv_proftpd - Restart proftpd.
restartsrv_pureftpd - Restart pure-ftpd.
restartsrv_spamd - Restart spamd.
restartsrv_sshd - Restart sshd.
restartsrv_syslogd - Restart syslogd.
restartsrv_tomcat - Restart tomcat.
restartsrv_xinetd - Restart xinetd.
restoremail - Restores a user's mail.
reswhostmgr - Restart whostmgr.
rpmup - Upgrade redhat/mandrake errata/security.
rrdtoolinstall - Installs RRD Tool.
runstatsonce - Runs statistics (should be used from the crontab).
runweblogs - Run analog/webalizer/etc. for a user.
safeperlinstaller - Installs perl safely.
safeup2date - Runs up2date safely.
safeyum - Runs yum safely.
secureit - Remove unnecessary suid binaries.
securemysql - Attempts to secure the MySQL configuration.
securetmp - Adds securetmp to system startup.
setupfp - Install FrontPage 3 on an account.
setupfp4 - Install FrontPage 4 (2000) installer on an account.
setupfp5 - Install FrontPage 5 (2002) installer on an account.
setupfp5.nosueuxec - Install FrontPage 5 (2002) installer on an account when not using suexec.
showexelist - Shows exe processes.
simpleps - Display the process list.
smartcheck - Checks hard drive integrity.
smtpmailgdionly - Enables SMTP Mail Protection.
spamboxdisable - Disables SpamAssassin's spambox delivery for all accounts.
suspendacct - Suspends an account.
sysup - update cPanel RPMs.
unlimitnamed - Installs the latest version of bind patched to support greater than 512 ips on the server.
unblockip - Unblocks an IP blocked by portsentry.
unsetupfp4 - Removes FrontPage 4 or 5 from an account.
unslavenamedconf - If the user accidentally sets a DNS master as local server, this will repair named.conf after the loop.
unsuspendacct - Unsuspends an account.
upcp - Updates cPanel.
updated - Updates /scripts.
updatefrontpage - Updates FrontPage
updatenow - Updates /scripts NOW.
updatephpconf - Updates PHP configuration files.
whoowns - Finds out who owns a domain.
wwwacct - Creates an account.
xaddonreport - Reports the current addon scripts installed.
Apache

/usr/local/apache
+ bin- apache binaries are stored here – httpd, apachectl, apxs
+ conf – configuration files – httpd.conf
+ cgi-bin
+ domlogs – domain log files are stored here
+ htdocs
+ include – header files
+ libexec – shared object (.so) files are stored here – libphp4.so,mod_rewrite.so
+ logs – apache logs – access_log, error_log, suexec_log
+ man – apache manual pages
+ proxy -
+ icons -
Init Script :/etc/rc.d/init.d/httpd – apache start script
Cpanel script to restart apache – /scripts/restartsrv_httpd

Exim

Conf : /etc/exim.conf – exim main configuration file
/etc/localdomains – list of domains allowed to relay mail
Log : /var/log/exim_mainlog – incoming/outgoing mails are logged here
/var/log/exim_rejectlog – exim rejected mails are reported here
/exim errors are logged here
Mail queue: /var/spool/exim/input
Cpanel script to restart exim – /scripts/restartsrv_exim
Email forwarders and catchall address file – /etc/valiases/domainname.com
Email filters file – /etc/vfilters/domainname.com
POP user authentication file – /home/username/etc/domainname/passwd
catchall inbox – /home/username/mail/inbox
POP user inbox – /home/username/mail/domainname/popusername/inbox
POP user spambox – /home/username/mail/domainname/popusername/spam
Program : /usr/sbin/exim (suid – -rwsr-xr-x 1 root root )
Init Script: /etc/rc.d/init.d/exim

ProFTPD

Program :/usr/sbin/proftpd
Init Script :/etc/rc.d/init.d/proftpd
Conf: /etc/proftpd.conf
Log: /var/log/messages, /var/log/xferlog
FTP accounts file – /etc/proftpd/username – all ftp accounts for the domain are listed here

Pure-FTPD

Program : /usr/sbin/pure-ftpd
Init Script :/etc/rc.d/init.d/pure-ftpd
Conf: /etc/pure-ftpd.conf
Anonymous ftp document root – /etc/pure-ftpd/ip-address

Frontpage Extensions

Program – (Install): /usr/local/frontpage/version5.0/bin/owsadm.exe
Uninstall and then install for re-installations
FP files are found as _vti-bin, _vti-pvt, _vti-cnf, vti-log inside the public_html

Mysql

Program : /usr/bin/mysql
Init Script : /etc/rc.d/init.d/mysql
Conf : /etc/my.cnf, /root/.my.cnf
Data directory – /var/lib/mysql – Where all databases are stored.
Database naming convention – username_dbname (eg: john_sales)
Permissions on databases – drwx 2 mysql mysql
Socket file – /var/lib/mysql/mysql.sock, /tmp/ mysql.sock

SSHD

Program :/usr/local/sbin/sshd
Init Script :/etc/rc.d/init.d/sshd
/etc/ssh/sshd_config
Log: /var/log/messages

Perl

Program :/usr/bin/perl
Directory :/usr/lib/perl5/5.6.1/

PHP

Program :/usr/local/bin/php, /usr/bin/php
ini file: /usr/local/lib/php.ini – apache must be restarted after any change to this file
php can be recomplied using /scripts/easyapache

Named(BIND)

Program: /usr/sbin/named
Init Script: /etc/rc.d/init.d/named
/etc/named.conf
db records:/var/named/
/var/log/messages
————————————————————————————————————————————–
Cpanel installation directory structure

/usr/local/cpanel
+ 3rdparty/ – tools like fantastico, mailman files are located here
+ addons/ – AdvancedGuestBook, phpBB etc
+ base/ – phpmyadmin, squirrelmail, skins, webmail etc
+ bin/ – cpanel binaries
+ cgi-sys/ – cgi files like cgiemail, formmail.cgi, formmail.pl etc
+ logs/ – cpanel access log and error log
+ whostmgr/ – whm related files

WHM related files

/var/cpanel – whm files
+ bandwidth/ – rrd files of domains
+ username.accts – reseller accounts are listed in this files
+ packages – hosting packages are listed here
+ root.accts – root owned domains are listed here
+ suspended – suspended accounts are listed here
+ users/ – cpanel user file – theme, bwlimit, addon, parked, sub-domains all are listed in this files
+ zonetemplates/ – dns zone template files are taken from here

Common CPanel scripts

cpanel/whm Scripts are located in /scripts/
+ addns – add a dns zone
+ addfpmail – Add frontpage mail extensions to all domains without them
+ addfpmail2 -Add frontpage mail extensions to all domains without them
+ addnetmaskips – Add the netmask 255.255.255.0 to all IPs that have no netmask
+ addnobodygrp – Adds the gorup nobody and activates security
+ addpop – add a pop account
+ addservlets – Add JSP support to an account (requires tomcat)
+ addstatus – (Internal use never called by user)
+ adduser – Add a user to the system
+ bandwidth – (OLD)
+ betaexim – Installs the latest version of exim
+ biglogcheck – looks for logs nearing 2 gigabytes in size
+ bsdcryptoinstall – Installs crypto on FreeBSD
+ bsdldconfig – Configures the proper lib directories in FreeBSD
+ bsdpkgpingtest – Tests the connection speed for downloading FreeBSD packages
+ buildbsdexpect – Install expect on FreeBSD
+ builddomainaddr – (OLD)
+ buildeximconf – Rebuilds exim.conf
+ buildpostgrebsd-dev – Installs postgresql on FreeBSD.
+ chcpass – change cpanel passwords
+ easyapache – recompile/upgrade apache and/or php
+ exim4 – reinstall exim and fix permissions
+ fixcommonproblems – fixes most common problems
+ fixfrontpageperm – fixes permission issues with Front Page
+ fixmailman – fixes common mailman issues
+ fixnamed – fixes common named issues
+ fixndc – fixes rndc errors with named
+ fixquotas – fixes quota problems
+ fullhordereset – resets horde database to a fresh one – all previous user data are lost
+ initquotas – initializes quotas
+ installzendopt – installs zend optimizer
+ killacct – terminate an account – make sure you take a backup of the account first
+ mailperm – fixes permission problems with inboxes
+ park – to park a domain
+ pkgacct – used to backup an account
+ restartsrv – restart script for services
+ restorepkg – restores an account from a backup file ( pkgacct file)
+ runlogsnow – update logs of all users
+ runweblogs – update stats for a particular user
+ securetmp – secures /tmp partition with options nosuexec and nosuid
+ suspendacct – suspends an account
+ unsuspendacct – unsuspends a suspended account
+ upcp – updates cpanel to the latest version
+ updatenow – updates the cpanel scripts
+ updateuserdomains – updates userdomain entries
Important cpanel/whm files
/etc/httpd/conf/httpd.conf – apache configuration file
/etc/exim.conf – mail server configuration file
/etc/named.conf – name server (named) configuration file
/etc/proftpd.conf – proftpd server configuration file
/etc/pure-ftpd.conf – pure-ftpd server configuration file
/etc/valiases/domainname – catchall and forwarders are set here
/etc/vfilters/domainname – email filters are set here
/etc/userdomains – all domains are listed here – addons, parked,subdomains along with their usernames
/etc/localdomains – exim related file – all domains should be listed here to be able to send mails
/var/cpanel/users/username – cpanel user file
/var/cpanel/cpanel.config – cpanel configuration file ( Tweak Settings )*
/etc/cpbackup-userskip.conf -
/etc/sysconfig/network – Networking Setup*
/etc/hosts -
/var/spool/exim -
/var/spool/cron -
/etc/resolv.conf – Networking Setup–> Resolver Configuration
/etc/nameserverips – Networking Setup–> Nameserver IPs ( FOr resellers to give their nameservers )
/var/cpanel/resellers – For addpkg, etc permissions for resellers.
/etc/chkserv.d – Main >> Service Configuration >> Service Manager *
/var/run/chkservd – Main >> Server Status >> Service Status *
/var/log/dcpumon – top log process
/root/cpanel3-skel – skel directory. Eg: public_ftp, public_html. (Account Functions–>Skeleton Directory )*
/etc/wwwacct.conf – account creation defaults file in WHM (Basic cPanel/WHM Setup)*
/etc/cpupdate.conf – Update Config *
/etc/cpbackup.conf – Configure Backup*
/etc/clamav.conf – clamav (antivirus configuration file )
/etc/my.cnf – mysql configuration file
/usr/local/Zend/etc/php.ini OR /usr/local/lib/php.ini – php configuration file
/etc/ips – ip addresses on the server (except the shared ip) (IP Functions–>Show IP Address Usage )*
/etc/ipaddrpool – ip addresses which are free
/etc/ips.dnsmaster – name server ips
/var/cpanel/Counters – To get the counter of each users.
/var/cpanel/bandwidth – To get bandwith usage of domain

If the user forget the user name or password we can retrieve it. Follow the simple steps.
STEP 1:
Obtain the database in which the user deatil is stored.
This can be obtained from the file /home /<username>/public_html/wp-config.php
STEP2:
Go to users cpanel.
select phpmyadmin.
Select the database that we obtained from STEP 1.
select wp_users
In that we can edit the password.
STEP3
The Password is actually MD5 encrypted.
So to edit password.
Delete the existing password.
Go to google and search for MD5 converter and obtain the MD5 encryption of our new password.
Paste it int the password column.
Click Go button.
http://www.iwebtool.com/md5 ————->> MD5 convertion

1. screen

Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). The same way tabbed browsing revolutionized the web experience, GNU Screen can do the same for your experience in the command line. Instead of opening up several terminal instances on your desktop or using those ugly GNOME/KDE-based tabs, Screen can do it better and simpler. Not only that, with GNU Screen, you can share sessions with others and detach/attach terminal sessions. It is a great tool for people who have to share working environments between work and home.
-S name
Specify a name for the session being started.
screen -S 999 —->> Creating a new screen with name ” 999 “
We can start a job here.
Ctrl-A D –> Detach screen from this terminal. (detach)
-ls--list
Print list of pid.tty.host strings identifying screen sessions.
screen -ls —->> Listing all screens
There is a screen on:
30291.999 (Detached)    —->> Screen Id
1 Socket in /tmp/screens/S-root.
-r sessionowner/[pid.tty.host] —>> Resume detached session.
# screen -r 30291.999 —>> Resuming
Removing a dead screen
———————————–
# screen -ls
There are screens on:
9703.upcp (Dead ???)
9603.new (Detached)
25803.upcp (Dead ???)
Remove dead screens with ‘screen -wipe’.
3 Sockets in /var/run/screen/S-root.
screen -lsThere are screens on: 9703.upcp (Dead ???) 9603.new (Detached) 25803.upcp (Dead ???)Remove dead screens with ‘screen -wipe’.3 Sockets in /var/run/screen/S-root.
screen -wipe <screen name>
screen -wipe 25803.upcp

2: rsync : Remote file copy – Synchronize file trees across local disks, directories or across a network.


rsync is a software application for Unix systems which synchronizes files and directories from one location to another. rsync can copy or display directory contents and copy files, optionally using compression and recursion.rsync was originally written as a replacement for rcp and scp. In daemon mode, rsync listens on the default TCP port of 873, serving files in the native rsync protocol or via a remote shell such as RSH or SSH.
Destination options:
 -a, --archive               archive mode
 -b, --backup               make backups (default ~ suffix)
 -z, --compress            compress file data
How to copy it:
-e, --rsh=COMMAND           specify rsh replacement (eg: -e ssh )
-v, --verbose                           increase verbosity
            --exclude "*.c"   would exclude all filenames matching *.c
           --exclude "/new"  would exclude a file in the base directory called new
A: rsync locally
rsync -av /home/test/Downloads/ /Softwares
B: rsync remotely 
rsync [OPTION] … SRC [SRC] … [USER@]HOST:DEST
rsync [OPTION] … [USER@]HOST:SRC [DEST]
rsync -av -e ssh <user>@<source ip>:<source dir> <destination dir> // Trying to rsync from destination server
rsync -av -e ssh <source dir> <user>@<destination ip>:<destination dir> //Trying from source server
Eg : rsync -av -e ssh root@11.11.11.1:/usr/home/storage/Downloads/ /mnt/DroboFS/Shares/HighRez
rsync -av -e ssh /home/abhi/Music/Songs/ root@10.10.2.23:/home/lenin/Music


1. Download the version of Linux you wish to install in USB drive
2. Download Unetbooin application from http://downloads.sourceforge.net/sourceforge/unetbootin/unetbootin-windows-357.exe?use_mirror=nchc
3. Open the application Unetbooin
4. Select the second option “Diskimage” and select ISO mode
5. Make sure you have selected the correct location of your USB drive
6. Then click OK
7. When it finish copying, select reboot now and boot from your usb drive

Understanding file permissions


In GNU/Linux every user has his own user account, and is a member of one or more user groups. Similarly, each file belongs to a user and to a user group. For restricting file access, GNU/Linux (and Unix in general) defines three different types of rights:
- Read (symbolized by the letter r), which means that the file can be read;
- Write (symbolized by the letter w), which means that the content of the file can be changed;
- Execute (symbolized by the letter x), which means that the file can be executed.
For each file, each of these rights (Read, Write and Execute) are defined for three sets of users :
- The user (symbolized by the letter u), who is the owner of the file.
- The group (symbolized by the letter g), who represents all the users who are members of the group which the file belongs to (as a file belongs both to a user, and a user group).
- The others (symbolized by the letter o), who basically represent all the users that are neither members of the group nor the owner of the file.
For instance, if a file belongs to George (as the owner) and Administrators (as the group), it can define different Read, Write and Execute permissions for George, for members of the "Administrators" group, and for all other users.

Reading file permissions : ls -l

All information related to file permissions is contained within the file and can be viewed by the "ls -l" command:
ls -l myfile
-rwxr-x--- 1 george administrators 10 2006-03-09 21:31 myfile
As you can see in this example, the "ls -l" command gives a lot of information about the file "myfile":
- Its name, "myfile";
- Its permissions, "-rwxr-x---";
- Its owner, "george";
- Its group, "administrators";
- And other information which is not relevant to this article.
The way permissions are shown can seem a bit confusing if you're new to GNU/Linux or Unix, but don't be mistaken, it is very simple. The first character simply indicates the type of file as indicated in the table below:
CharacterType of file
-regular file
ddirectory
lsymbolic link
ssocket
pnamed pipe
ccharacter device file (unbuffered)
bblocked device file (buffered)
In this case myfile is a regular file. Let's have a look at the other nine characters: "rwxr-x---".
The first three characters indicate whether or not the read, write and execute permissions are given to the owner (in this case, George). If they are, their character representation appear (r, w or x), otherwise they are replaced by the character "-". In the same manner, the next three characters indicate whether or not these permissions are given to the group (in this case, Administrators). Finally, the last three characters indicate whether the same rights are given to the others (in this case, people who are not members of the Administrators group).
LetterPermission
rRead
wWrite
xExecute, Go through (for directories)
-No permission

LetterType of users
uUser (owner of the file)
gGroup (group to which belong the file)
oOther (users who are neither a member of the Group nor the owner of the file)
aAll (everybody)
So, in our example myfile features the following set of permissions : "
rwxr-x---
". This means that George has all three rights on it, that members of the Administrators group can only read (R) and execute (X) the file, and that everybody else can't do anything with the file. You could imagine that this file, written and maintained by George could be an executable script dedicated to the administrators and not made available to other users.. but hey.. this is only an example, so let's not assume too much :) The important thing is that you now understand the concept of file permissions and that you know how to read them using the "ls -l" command. The next step is to learn how to change them.

Changing file permissions : chmod

You can change the permissions of your files (or other people's files if you're the root superuser) by using the command "chmod". The syntax is very simple. For instance if George decides to give write permissions to the administrators, he will type:
chmod g+w myfile
g represents the group of the file (administrators).
w represents the write permission.
+ represents the fact that the permission is added.
If George then lists the permissions using ls -l he obtains:
ls -l myfile
-rwxrwx--- 1 george administrators 10 2006-03-09 21:31 myfile
As you can see, the administrators now have write access to the file, and permission to change its content.
The "chmod" command takes 4 parameters:
- The type of users to apply the change of permissions for (u for user, g for group, o for others, a combination of them or a for all three of them).
- The type of change to make (+ to add permissions, - to remove permissions, = to define permissions)
- The type of permissions to apply the change with (r for read, w for write, x for execute)
- The file or group of files to apply the change on (filename for a precise file, but wildcard characters for multiple files)
Let's have a look at a few examples:
chmod o+r myfile adds read permission to the others on myfile;
chmod ug+rx myfile adds read and execute permissions to both the owner (user) and the group on myfile;
chmod a-rwx myfile removes all permissions to everybody (all) on myfile;
chmod a=rx *.txt defines permissions to be read and write to everybody on all files suffixed by .txt.

The chmod command also accepts another syntax which is quite popular among system administrators: the octal system. Rather than using letters such as u, g, o, a, r, w and x.. you can use octal numbers. The main advantage is that once you're used to it, it is faster to use. Also, because it sets permissions rather than adding or removing them, you don't accidentally overlook anything. Here is how the octal numbers work:
Each permission is given a value:
PermissionValue
-0
x1
w2
r4
Values add up when you combine permissions. Consequently the total value can go from 0 (no permission at all) to 7 (full permissions):
PermissionValue
---0
--x1
-w-2
-wx3
r--4
r-x5
rw-6
rwx7

Finally a value is given for each of the three types of users (User, Group and Other) and these three numbers ranging from 0 to 7 are put together to form the octal number. This is the number you can use with "chmod".
For instance:
chmod 750 myfile
750 means 7 (rwx) for the owner, 5 (r-x) for the group and 0 (---) for others. As a result, the permissions of myfile will be "rwxr-x---". As seen above this command is equivalent to:
chmod u=rwx,g=rx myfile; chmod o-rwx myfile;  
Here are some common uses of the octal numbers:
chmod 755 myfile : rwxr-xr-x, all rights to the owner, other people only read and execute;
chmod 644 myfile : rw-r--r--, owner car read and write, other people only read;
chmod 777 myfile : can be considered bad practice in some cases, full permissions to everybody.

Changing file owner or group : chown, chgrp

You can give ownership of your files to somebody else, or change the group that they belong to, by using the commands "chown" and "chgrp". "chown" allows you yo change the owner of the file, and "chgrp" allows you to change its group.
For instance, if George decides to give ownership of myfile to Robert, he can simply type:
chown robert myfile
Also, if Robert later on decides to make the file only available to members of the group "SeniorAdmin" group rather than to those of the group "Administrators", he can type:
chgrp senioradmin myfile
Note: The "chown" command also allows to change the group ownership. In fact George could have directly typed the following command:
chown robert:senioradmin myfile
Setting the sticky bit on a directory : chmod +t
If you have a look at the /tmp permissions, in most GNU/Linux distributions, you'll see the following:
clem@pluto:/$ ls -l | grep tmp
drwxrwxrwt 10 root root 4096 2006-03-10 12:40 tmp
The "t" in the end of the permissions is called the "sticky bit". It replaces the "x" and indicates that in this directory, files can only be deleted by their owners, the owner of the directory or the root superuser. This way, it is not enough for a user to have write permission on /tmp, he also needs to be the owner of the file to be able to delete it.
In order to set or to remove the sticky bit, use the following commands:
chmod +t tmp
chmod -t tmp

Setting the SGID attribute on a directory : chmod g+s

If the SGID (Set Group Identification) attribute is set on a directory, files created in that directory inherit its group ownership. If the SGID is not set the file's group ownership corresponds to the user's default group.
In order to set the SGID on a directory or to remove it, use the following commands:
chmod g+s directory
chmod g-s directory
When set, the SGID attribute is represented by the letter "s" which replaces the "x" in the group permissions:
ls -l directory
drwxrwsr-x 10 george administrators 4096 2006-03-10 12:50 directory

Setting SUID and SGID attributes on executable files : chmod u+s, chmod g+s

By default, when a user executes a file, the process which results in this execution has the same permissions as those of the user. In fact, the process inherits his default group and user identification.
If you set the SUID attribute on an executable file, the process resulting in its execution doesn't use the user's identification but the user identification of the file owner.
For instance, consider the script myscript.sh which tries to write things into mylog.log :
ls -l
-rwxrwxrwx 10 george administrators 4096 2006-03-10 12:50 myscript.sh
-rwxrwx--- 10 george administrators 4096 2006-03-10 12:50 mylog.log
As you can see in this example, George gave full permissions to everybody on myscript.sh but he forgot to do so on mylog.log. When Robert executes myscript.sh, the process runs using Robert's user identification and Robert's default group (robert:senioradmin). As a consequence, myscript fails and reports that it can't write in mylog.log.
In order to fix this problem George could simply give full permissions to everybody on mylog.log. But this would make it possible for anybody to write in mylog.log, and George only wants this file to be updated by his myscript.sh program. For this he sets the SUID bit on myscript.sh:
chmod u+s myscript.sh
As a consequence, when a user executes the script the resulting process uses George's user identification rather than the user's. If set on an executable file, the SUID makes the process inherit the owner's user identification rather than the one of the user who executed it. This fixes the problem, and even though nobody but George can write directly in mylog.log, anybody can execute myscript.sh which updates the file content.
Similarly, it is possible to set the SGID attribute on an executable file. This makes the process use the owner's default group instead of the user's one. This is done by:
chmod g+s myscript.sh 
By setting SUID and SGID attributes the owner makes it possible for other users to execute the file as if they were him or members of his default group.
The SUID and GUID are represented by a "s" which replaces the "x" character respectively in the user and group permissions:
chmod u+s myscript.sh
ls -l
-rwsrwxrwx 10 george administrators 4096 2006-03-10 12:50 myscript.sh
chmod u-s myscript.sh
chmod g+s myscript.sh
ls -l
-rwxrwsrwx 10 george administrators 4096 2006-03-10 12:50 myscript.sh

Setting the default file creation permissions : umask

When a file is created, its permissions are set by default depending on the umask setting. This value is usually set for all users in /etc/profile and can be obtained by typing:
umask
The default umask value is usually 022. It is an octal number which indicates what rights will be removed by default to all new files. For instance, 022 indicates that write permissions will not be given to group and other.
By default, and with a umask of 000, files get mode 666 and directories get mode 777. As a result, with a default umask value of 022, newly created files get a default mode 644 (666 - 022 = 644) and directories get a default mode 755 (777 - 022 = 755).
In order to change the umask value, simply use the umask command and give it an octal number. For instance, if you want all new directories to get permissions rwxr-xr--- and files to get permissions rw-r----- by default (modes 750 and 640), you'll need to use a umask value which removes all rights to other, and write permissions to the group : 027. The command to use is:
umask 027