robb3369

Well-Known Member
Mar 1, 2008
122
1
68
cPanel Access Level
Root Administrator
Use this to remove DKIM from all users:

Code:
for user in `ls /var/cpanel/users`; do /usr/local/cpanel/bin/dkim_keys_uninstall $user; done
And to add DKIM back:
Code:
for user in `ls /var/cpanel/users`; do /usr/local/cpanel/bin/dkim_keys_install $user; done
 

saros

Active Member
Aug 28, 2013
30
0
6
cPanel Access Level
Root Administrator
not work

Code:
root@zeus [~]# for user in `ls /var/cpanel/users`; do /usr/local/cpanel/bin/dkim_keys_uninstall $user; done
/usr/local/cpanel/bin/dkim_keys_uninstall: usage: /usr/local/cpanel/bin/dkim_keys_uninstall <user> at /usr/local/cpanel/bin/dkim_keys_uninstall line 20.
/usr/local/cpanel/bin/dkim_keys_uninstall: usage: /usr/local/cpanel/bin/dkim_keys_uninstall <user> at /usr/local/cpanel/bin/dkim_keys_uninstall line 20.
 

mtindor

Well-Known Member
Sep 14, 2004
1,516
142
343
inside a catfish
cPanel Access Level
Root Administrator
It's quite possible that not all users in /var/cpanel/users have DKIM enabled, so that might be why some of them are failing to uninstall when you issue that command.

Also, keep in mind that if you are wanting to mass deactivate DKIM and then reinstall it with the purpose of upgrading weak DKIM keys to 1024-bit keys, I don't think this will do it.

Unless something has changed, in order to upgrade an account with 512-bit keys to 1024-bit DKIM keys, you have to (a) uninstall DKIM from the account, (b) remove the associated keys from /var/cpanel/domain_keys/public and /var/cpanel/domain_keys/private, and (c) then re-install DKIM on the account.

NOTE: Do NOT remove everything from /var/cpanel/domain_keys/public and /var/cpanel/domain_keys/private unless you understand what you are doing.

mike

not work

Code:
root@zeus [~]# for user in `ls /var/cpanel/users`; do /usr/local/cpanel/bin/dkim_keys_uninstall $user; done
/usr/local/cpanel/bin/dkim_keys_uninstall: usage: /usr/local/cpanel/bin/dkim_keys_uninstall <user> at /usr/local/cpanel/bin/dkim_keys_uninstall line 20.
/usr/local/cpanel/bin/dkim_keys_uninstall: usage: /usr/local/cpanel/bin/dkim_keys_uninstall <user> at /usr/local/cpanel/bin/dkim_keys_uninstall line 20.
 

robb3369

Well-Known Member
Mar 1, 2008
122
1
68
cPanel Access Level
Root Administrator
If you just do a grep in the users directory for HASDKIM=1, you will be able to use that as a basis for a list:

Code:
grep -l 'HASDKIM=1' /var/cpanel/users/*
The other thing you can do is create a shell script and go for it...

Code:
#!/bin/bash
cd /var/cpanel/users
for user in `grep -l HASDKIM=1 *`
do
        /usr/local/cpanel/bin/dkim_keys_uninstall $user
done
Then afterwards change HASDKIM=0 and use dkim_keys_install

Use at your own risk! TEST it first...
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
The command you used likely worked well, and only failed for the "root" and "nobody" entries in /var/cpanel/users that are not actual accounts. Did you verify to see if DKIM was uninstalled for the accounts?

Thank you.