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
Enjoy
WGET with FTP
Posted by Mayur's BLOG 0 comments
Useful IPTABLES Commands
Posted by Mayur's BLOG 0 comments
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
iptables -A INPUT -p tcp –dport
2. You can open UDP port with
iptables -A INPUT -p udp –sport
iptables -A INPUT -p udp –sport
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.
Enjoy
Shorthand at the Linux Command Prompt
Posted by Mayur's BLOG 0 comments
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.
Enjoy
How to Set Maximum Emails Per Hour for Particular Domain
Posted by Mayur's BLOG 2 comments
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:
The maximum each domain can send out per hour (0 is unlimited)
[root@server ~]#vi /var/cpanel/maxemailsperhour
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:
[root@server ~]# vi /var/cpanel/maxemails
# If you update this file you must run /scripts/build_maxemails_config
[root@server ~]# vi /var/cpanel/maxemails
# If you update this file you must run /scripts/build_maxemails_config
emails.com=500
domain.net=1000
[root@server ~]#/scripts/build_maxemails_config
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.
[root@server ~]#cat /var/cpanel/maxemailsperdomain/emails.com
500
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..
Enjoy
Change Linux timezone
Posted by Mayur's BLOG 0 comments
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
Posted by Mayur's BLOG 0 comments
If you are receiving the following error code while Horde webmail login.
Error::
Horde "A fatal error has occurred Could not connect to database for SQL
SessionHandler. Details have been logged for the administrator"
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
#vi /usr/local/cpanel/base/horde/config/conf.php
$conf['sql']['hostspec'] = 'localhost';
$conf['sql']['username'] = 'horde';
$conf['sql']['password'] = '';
$conf['sql']['protocol'] = 'tcp';
$conf['sql']['database'] = 'horde';
#mysql -uhorde -p
You should obtain the Error.
"ERROR 1045 (28000): Access denied for user
'horde'@'localhost' (using password: YES)"
#mysql> grant all privileges on horde.* to horde@localhost identified by '';
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.
#mysql
#mysql> use horde;
#mysql> repair table horde_sessionhandler;
Enjoy
Stats without login to cpanel
Posted by Mayur's BLOG 0 comments
Using following method you can access your webalizer stats without login to cPanel
# cd /home/
# 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.
Enjoy
How to Check Memory Usage on Linux Servers.
Posted by Mayur's BLOG 0 comments
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
Posted by Mayur's BLOG 0 comments
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 it
Enjoy:)
Cpanel Icon Missing From WHM List Accounts.
Posted by Mayur's BLOG 1 comments
Cpanel Icon Missing From WHM List Accounts.
Cause :-
Following option selected in WHM >> Tweak Settings
Disable login with root or reseller password into the users’ cPanel interface. Also disable switch account dropdown in themes with switch account feature |
You need to uncheck the following option in WHM >> Tweak Settings under System tab
Disable login with root or reseller password into the users’ cPanel interface. Also disable switch account dropdown in themes with switch account feature |
Enjoy:)