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