Koozali.org: home of the SME Server

Any way to bulk change all email user passwords? THANKS TO ALL WHO RESPONDED!

Offline libitguy

  • 4
  • +0/-0
:-D This is great! I'll be trying out a few of these.  :D
Mark

Hi,
We're moving email off our SME server. We need to change all user passwords to the same password to facilitate this. Is there any way to do for all users at the same time, or are we stuck with resetting them one by one?

Thanks!
Mark
« Last Edit: May 29, 2014, 11:24:27 PM by libitguy »

Offline pizzaco

  • **
  • 53
  • +0/-0
Re: Any way to bulk change all email user passwords?
« Reply #1 on: May 29, 2014, 08:56:20 PM »
I've used this snippet to change passwords from the command line before. It only does one at a time, but it shouldn't be too hard to create a script to run it for each user:

Code: [Select]
perl -e "use esmith::util;esmith::util::setUserPassword( '<UserName>', '<Password>' );"
/sbin/e-smith/signal-event  password-modify <UserName>

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Any way to bulk change all email user passwords?
« Reply #2 on: May 29, 2014, 09:30:10 PM »
Quickest way to change them all at once is to edit /etc/shadow. Not secure, but neither is having all passwords the same.

If you just want to backup all the email messages, you can do that via:

tar zcvf /tmp/mail.backup.tar.gz /home/e-smith/Maildir /home/e-smith/files/users/*/Maildir

Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: Any way to bulk change all email user passwords?
« Reply #3 on: May 29, 2014, 09:37:20 PM »
Charlie, I think OP is asking for password to use something like imapsync (my guess)
IIRC dovecot should support a sort of admin logon.. IIRC (again) firewall-services' crew has a working dovecot contrib..
it should be nice to have it merged into base

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Any way to bulk change all email user passwords?
« Reply #4 on: May 29, 2014, 11:12:28 PM »
Charlie, I think OP is asking for password to use something like imapsync (my guess)

Sure. I was just suggesting that TMTOWTDI.

Quote
IIRC dovecot should support a sort of admin logon..

Can't be done without either running dovevot as root user somehow, or redesigning the mail storage format. IOW, not a trivial task. 'admin' already controls user passwords, so a backdoor is already there if needed (just can't be done surrepticiously).