Enable SPF records for all accounts on cPanel server – command

Nov 24 • All • 861 Views • No Comments on Enable SPF records for all accounts on cPanel server – command

Hello Guys,

We all know how to enable SPF for an account through cPanel. But what if it is to be enabled for mutliple accounts on a server or all accounnts on a server. Logging into cPanel of each user account individually and enabling it is possible but is not practical as it wastes a lot of time (for us and for the clients).

Fortunately there is a command line script provided by cPanel to enable SPF for a domain. Now what if we take the list of accounts of all the accounts on our server and enable SPF via this script in a for loop!! Will it work? Yes it will 🙂

Enter the cPanel server on which to enable SPF for all accounts as root user and issue the below command to enable SPF for all accounts.

for i in `ls /var/cpanel/users` ;do /usr/local/cpanel/bin/spf_installer $i ;done

If SPF is to be enabled for a selected list of accounts, save the list of cPanel usernames(one entry in each line) in a file (for eg: here I have named the file as filename) and execute the command calling `cat filename` instead of `ls /var/cpanel/users`

for i in `cat filename` ;do /usr/local/cpanel/bin/spf_installer $i ;done

Thats it;) You should be good to go now. 😉

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

« »