Tuesday, 9 October 2012

cPanel in Command line


Contact Information & Preferences
Change the email address inside of cPanel for alert emails.
# grep CONTACT /var/cpanel/users/username
Modify the above lines in the users file and run: /scripts/updateuserdomains

Email Notification settings
Modify the below lines to affect emails being sent on quota hits.
# grep notify /home/username/.cpanel/contactinfo

Change Style
# grep RS /var/cpanel/users/username
Change the above line and run /scripts/updateuserdomains

Change Language
# grep LANG /var/cpanel/users/username
Change the above line to the language of choice and run /scripts/updateuserdomains

Change Owner
# grep OWNER /var/cpanel/users/username
Owner should be set to root for a shared account or the reseller user for a reseller/resold account. Run /scripts/updateuserdomains after making any changes to the owner.

Email Accounts
List all Email accounts.
# user=ausisdha; gawk -F":" '{ print $6 }' /home/$user/etc/*/passwd |gawk -F"/" '{ print $6"@"$5 }'

Create Email accounts
# /scripts/addpop user@domain.com e60aGlvJpdts

Spam Assassin
Enable Spamassassin (to disable remove the file)
# touch /home/username/.spamassassinenable
# chown username. /home/username/.spamassassinenable

Adjust required_score (the score required to mark the email as spam, lower numbers will create more positives) Default value is 5.
# grep required_score /home/username/.spamassassin/user_prefs

Add domain blacklist (will mark email from this domain as spam)
# echo "blacklist_from domain.com" >> /home/username/.spamassassin/user_prefs
# tail /home/username/.spamassassin/user_prefs

Add domain whitelist (will mark all email from domain as non-spam)
# echo "whitelist_from *@domain.com" >> /home/username/.spamassassin/user_prefs
# tail /home/username/.spamassassin/user_prefs

enable Spam Auto Delete
# wget -qO /home/username/.cpanel/filter.yaml http://toolbox.hostgator.com/ccranford/filter.yaml
# chown username. /home/username/.cpanel/filter.yaml

Forwarders
All forwards are in /etc/valiases/domain.com
# cat /etc/valiases/ausisdhaka.net

Auto Responders
When an auto responder is created, cPanel will ad a virtual host entry that will call the autorespond application and then check the configuration that it will create in the /home/username/.autorespond directory for more information.
# grep autorespond /etc/valiases/biwere.info

Default Address
This would be a catch all setup for the default user of *: in the aliases file.
# grep "^*:" /etc/valiases/domain.com

Mailing Lists
Show all mailing lists ( add a domain on the end to see all mailing lists for that domain ).
# /usr/local/cpanel/3rdparty/mailman/bin/list_lists -b

Show all members on a mailing list
# /usr/local/cpanel/3rdparty/mailman/bin/list_members

User Level Filtering
Best performed inside of the cPanel interface as it does have cache files that are created and the syntax requires to locations.
# /home/username/etc/domain_name/email_account/filter.yaml
# /home/username/etc/domain_name/email_account/filter

Account Level Filtering
Best done through the cPanel interface.
# cat /home/username/.cpanel/filter.yaml

Disk Space Usage
Run from the users home directory, proceed top down to find diskspace issues.
# find -maxdepth 1 -exec du -sk {} \;|sort -rn|head | while read size loc; do echo "scale=2; $size/1024" | bc|gawk '{ print $1"MB '"$loc"' " }';done|column -t
cd tmp
# find -maxdepth 1 -exec du -sk {} \;|sort -rn|head| while read size loc; do echo "scale=2; $size/1024" | bc|gawk '{ print $1"MB '"$loc"' " }';done|column -t

Security Questions
To add a “trusted” IP for the user root add the IP address to the following file:
# /var/cpanel/userhomes/cpanel/.cpanel/securitypolicy/iplist/root

4 comments:

Thomas John Paul said...

you can open the files using VI Editors right, to edit settings.Thats not mentioned :(

Hemanth said...

Hello John,

Yes, I do agree that you can open a file using vi.... however that is basics of linux. This post is completly about cPanel command line.

If you like to know about linux command line basics, there are other posts in my blog to surf.... Plz have a look at it on basics command line for linux.....

Unknown said...

cPanel is used to control and manage the website, from the cPanel you can have control to manage your software, config options, scripts, databases etc.

Unknown said...

With the web hosting services, you are provided a cPanel which is the better way to manage your scripts and functions according to their use.
web hosting india