WGET with FTP

Here are some useful commands to download data from an account which is exist on different server.

wget ftp://username:password@ftp.domainname.com * -r

For exa : wget ftp://test:celita0201@ftp.domainname.com * -r

OR

wget ftp://ftp.domainname.com/* --ftp-user=username --ftp-pass=password -r

wget ftp://ftp.domainname.com/* --ftp-user=test@domainname.com --ftp-pass=neHGyxhjr -r


EnjoyWink

Useful IPTABLES Commands

TO OPEN OR CLOSE PORTS:

Before using commands for opening the port please make sure the specific port is already opened and what is the use of that port.

you can verify the port with

netstat -nap | grep :

1.you can open OR block TCp port with following syntax

iptables -A INPUT -p tcp –dport -j ACCEPT
iptables -A INPUT -p tcp –dport -j DROP - to block the port

2. You can open UDP port with

iptables -A INPUT -p udp –sport -j ACCEPT
iptables -A INPUT -p udp –sport -j DROP - to block the port

after that

3 service iptables save

TO allow or block IPs:

iptables -A INPUT -s <> -j ACCEPT
iptables -A INPUT -s <> -j DROP - to block the IP

Make sure to save IPtables if you did changes in IPtables


Usefull Options
Either long or short options are allowed.
--append -A chain Append to chain
--delete -D chain Delete matching rule from chain
--delete -D chain rulenum
Delete rule rulenum (1 = first) from chain
--insert -I chain [rulenum]
Insert in chain as rulenum (default 1=first)
--replace -R chain rulenum
Replace rule rulenum (1 = first) in chain
--list -L [chain] List the rules in a chain or all chains
--flush -F [chain] Delete all rules in chain or all chains
--zero -Z [chain] Zero counters in chain or all chains
--new -N chain Create a new user-defined chain
--delete-chain
-X [chain] Delete a user-defined chain
--policy -P chain target
Change policy on chain to target

service iptables save - To save IPtables
service iptables restart - To restart the IPtables firewall.

EnjoyWink

Shorthand at the Linux Command Prompt

Some of these are specific to the bash shell. I have not experimented enough with other shells to know which are common to all shells. See also the ``Bash Reference Card'', SSC (2000), available online.

* / - root directory

* ./ - current directory

* ./command_name - run a command in the current directory when the current directory is not on the path

* ../ - parent directory

* ~ - home directory

* $ - typical prompt when logged in as ordinary user

* # - typical prompt when logged in as root or superuser

* ! - repeat specified command

* !! - repeat previous command

* ^^ - repeat previous command with substitution

* & - run a program in background mode

* [Tab][Tab] - prints a list of all available commands. This is just an example of autocomplete with no restriction on the first letter.

* x[Tab][Tab] - prints a list of all available completions for a command, where the beginning is ``x''

* [Alt][Ctrl][F1] - switch to the first virtual text console

* [Alt][Ctrl][Fn] - switch to the nth virtual text console. Typically, there are six on a Linux PC system.

* [Alt][Ctrl][F7] - switch to the first GUI console, if there is one running. If the graphical console freezes, one can switch to a nongraphical console, kill the process that is giving problems, and switch back to the graphical console using this shortcut.

* [ArrowUp] - scroll through the command history (in bash)

* [Shift][PageUp] - scroll terminal output up. This also works at the login prompt, so you can scroll through your boot messages.

* [Shift][PageDown] - scroll terminal output down

* [Ctrl][Alt][+] - switch to next X server resolution (if the server is set up for more than one resolution)

* [Ctrl][Alt][-] - change to previous X server resolution

* [Ctrl][Alt][BkSpc] - kill the current X server. Used when normal exit is not possible.

* [Ctrl][Alt][Del] - shut down the system and reboot

* [Ctrl]c - kill the current process

* [Ctrl]d - logout from the current terminal

* [Ctrl]s - stop transfer to current terminal

* [Ctrl]q - resume transfer to current terminal. This should be tried if the terminal stops responding.

* [Ctrl]z - send current process to the background

* reset - restore a terminal to its default settings

* [Leftmousebutton] - Hold down left mouse button and drag to highlight text. Releasing the button copies the region to the text buffer under X and (if gpm is installed) in console mode.

* [Middlemousebutton] - Copies text from the text buffer and inserts it at the cursor location. With a two-button mouse, click on both buttons simultaneously. It is necessary for three-button emulation to be enabled, either under gpm or in XF86Config.


EnjoyWink

How to Set Maximum Emails Per Hour for Particular Domain

Its quite well known to all that in server's WHM, there is an option that allows you to set the Maximum amount of emails a domain can send per hour, which is a great way of reducing spam/mass emailing. This feature is located in the Server Configuration option, under Tweak Settings option, under the emails listing. The option looks like as follows:

Code:
The maximum each domain can send out per hour (0 is unlimited)
Alternatively, you can change the default maximum emails per hour by updating the file via SSH accessing the server.

Code:
[root@server ~]#vi /var/cpanel/maxemailsperhour
What if you or your clients want to send emails more than the default server side settings for specific domains...

Yes its possible, though its NOT ALLOWED and never been done on Shared Hosting and Reseller Hosting.

However, it's possible to customize such setting on VPS hosting/Semi-dedicated hosting/Dedicated hosting ...!

Here we go for the same....

Make sure you login as root in server, then run the following command which will open a blank text editor, with only the following entered inside of it:
Code:
[root@server ~]# vi /var/cpanel/maxemails
# If you update this file you must run /scripts/build_maxemails_config
Go ahead and type the following (Enter domain name for what you need):domain.com=value (Where it says value, enter the number of maximum emails that particular domain can send) say for example:
Code:
[root@server ~]# vi /var/cpanel/maxemails
# If you update this file you must run /scripts/build_maxemails_config
emails.com=500
domain.net=1000
Now, as per the original document stated, we’re going to have to run a command before the actual changes take effect. So after successfully exiting the text editor, go ahead and type the following:
Code:
[root@server ~]#/scripts/build_maxemails_config
After this command, you should be ready to go! Although it doesn’t appear to do anything, it sure makes those changes happen.

A file automatically get created under the directory [var/cpanel/maxemailsperdomain/]with the email value you've set for those particular domains.
Just to check, type the following which should return the value that you entered in the previous file.
Code:
[root@server ~]#cat /var/cpanel/maxemailsperdomain/emails.com
500
Congratulations.. You have done it.. !

Important:: Make sure that you are not setting the number of emails for your domains to a very high value as it might blacklist your server IP address to some email service providers like Yahoo, Hotmail, AOL etc..


EnjoyWink

Change Linux timezone

Select the method as per your Linux distribution:
If you are using Fedora / RHEL / Cent OS Linux
Type the redhat-config-date command at the command line to start the time and date properties tool.

# redhat-config-date


OR type setup and select time zone configuration (good for remote ssh text based Linux server sessiob)

# setup

Now, just follow on screen instructions to change 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

Enjoy:)

Horde Webmail Fatal Error

If you are receiving the following error code while Horde webmail login.

Error::

Code:
Horde "A fatal error has occurred Could not connect to database for SQL
SessionHandler. Details have been logged for the administrator"
Solution::

NOTE: You can fix it only if you have a root user privileges which means this will be helpful for VPS , Semi-dedicated Servers and Dedicated servers.

1. Check the Horde webmail configuration file
Code:
#vi /usr/local/cpanel/base/horde/config/conf.php
2. You can find the following entry in the conf.php
Code:
$conf['sql']['hostspec'] = 'localhost';
$conf['sql']['username'] = 'horde';
$conf['sql']['password'] = '';
$conf['sql']['protocol'] = 'tcp';
$conf['sql']['database'] = 'horde';
3. Try to connect the database horde using the following method
#mysql -uhorde -p

You should obtain the Error.
Code:
"ERROR 1045 (28000): Access denied for user
'horde'@'localhost' (using password: YES)"
4. Grant the privilege to the database using the mysql command prompt
Code:
#mysql> grant all privileges on horde.* to horde@localhost identified by '';
You can now login into the Horde Webmail now..!!!

Second solution is that, You can also try checking configuration file /etc/my.cnf and remove skip-innodb if its in there. Restart mysql service to ensure that the error has been fixed and Horde Webmail login works..

Another solution is to repair the table named "SessionHandler" in Horde Database from mysql command Prompt as follows.

Code:
#mysql
#mysql> use horde;
#mysql> repair table horde_sessionhandler;
These Fixes must fix your Horde webmail login problem..


EnjoyWink

Stats without login to cpanel

Using following method you can access your webalizer stats without login to cPanel

# cd /home//public_html
# ln -s ../tmp/webalizer stats
# chown username.username stats
# cd ../tmp
# chmod 755 ./webalizer


It will allow yourdomain.com/stats/ for viewing stats without logging in to cpanel
Its applicable for Webalizers stats only.

EnjoyWink

How to Check Memory Usage on Linux Servers.

Memory is one of the most important resource components on a server to ensure that process run smooth and fast. Thus, the availability of physical memory for any server is very important, especially for high load web host server which runs database server such as Oracle or MySQL, which require high memory utilization for smooth running. Linux [CentOS] which is popular on cPanel and Plesk web hosting server, comes with several commands and tools to check memory usage on server

1. meminfo
"/proc/meminfo" contain all your memory usage information when you type:
cat /proc/meminfo
you will get an out of your server memory info, below is an example of meminfo.



2. Using free Command
free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.

free -m
The command will display information about physical memory in MB.

free -m -t
Same with “free -m”, but -t switch will display a line containing the totals of physical memory and swap space.

free -m -s 10
The command will display memory status in megabytes on terminal with continuous polling delay at 10 seconds,You can specify any number for delay.




3. Using vmstat Command

vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity. The command will display report based on averages since last reboot.

Syntax of vmstat

vmstat -[options] [delay count]

vmstat 10
The command will pool average system resources usage level for a sampling period of 10 seconds at interval of 10 seconds, except the first result that is averages since the last reboot.
If no delay is specified, only one report is printed with the average values since boot.



4. Using top Command

Syntax of top

top
Using top is very simple, Just type "top" at command shell [without ""], it constantly update stats page will be shown.

top -d 2
Same as "top", but "-d" used to Specifies the delay between screen updates after 2 sec.

5. Using ps Command

Syntax of ps aux

ps -aux
aux is the options for ps command to see every process on the system.

To see only the memory resources occupied by each category of processes, such as Apache httpd, MySQL mysqld or Java, use the following command:

ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr


Enjoy:)

How to change exim default port

Well, I think there is no need to tell you that why some time we have to change default port (25) for exim so I directly come to the point instead of bla..bla..blaaaa..

For cpanel server:

You can run exim on another port by going to the 'Service Manager' in WebHost Manager and then enabling 'exim on another port' and choosing the port number.

For another servers:

Just add this first line to /etc/exim.conf and both 25 and 26 will work as smtp ports.

daemon_smtp_ports = 25 : 26
acl_smtp_rcpt = check_recipient
acl_smtp_data = check_message

Restart exim. Thats itWink

Enjoy:)

Cpanel Icon Missing From WHM List Accounts.

Problem :-
Cpanel Icon Missing From WHM List Accounts.

Cause :-
Following option selected in WHM >> Tweak Settings
Quote:
Disable login with root or reseller password into the users’ cPanel interface. Also disable switch account dropdown in themes with switch account feature
Solution :-
You need to uncheck the following option in WHM >> Tweak Settings under System tab
Quote:
Disable login with root or reseller password into the users’ cPanel interface. Also disable switch account dropdown in themes with switch account feature
Save the changes, now you will be able to see an Icon of cPanel in WHM List Accounts.

Enjoy:)