1

Topic: Reset password from CLI

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.6.5
- Deployed with iRedMail Easy or the downloadable installer? Download
- Linux/BSD distribution name and version: rockylinux 8.8
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Sogo 5.9.0.20231004

I'd like to know the tools script in
/opt/www/iredadmin/tools/reset_user_password.py

can be used for batch reset password, in my test case, somewhere it doesn't work.

It generate SSHA512 hash and somehow reset will not work ,
I copy out the sql and change it to SSHA hash and mysql it, then it  works.

Thank you.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2 (edited by Cthulhu 2023-10-09 02:24:33)

Re: Reset password from CLI

i created an own script for that:

#!/usr/bin/env bash
if [ X"$#" != X'2' ]; then
    echo "invalid argument"
    echo "bash ./mailboxpw.sh user@domain.tld password"
    exit 255
fi

# Read input
mailbox="$1"
password="$2"

#Crypt Password
CRYPT_PASSWD="$(doveadm pw -s 'ssha512' -p ${password})"

cat <<EOF
UPDATE mailbox SET password = '${CRYPT_PASSWD}' WHERE username = '${mailbox,,}';
EOF

exit 0

you can feed it several mailbox names and passwords and it can create a textfile with all SQL queries

3

Re: Reset password from CLI

@Cthulhu

Thank you for sharing, it works fine and it works great.

4

Re: Reset password from CLI

nice to hear that it solved your issues