cPanel changes through shell commands

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

Comments

  1. Thank you for sharing the article . It let me know something I didn’t know .I hope everyone here can find his or her dream ,then make it come true.
    cpanel

    ReplyDelete

Post a Comment

Popular posts from this blog

SVN: File remains in conflict

HowTo: Enable extended logging for exim

12 tweakings for WHM/cPanel to speed up WordPress