How to Reset a Linux Qmail Mailbox Password
Original Publishing Date:
2020-03-05
Table of Contents
Overview
This article describes how you can reset the password of a Linux Qmail mailbox after the detachment of the Linux Qmail module from your CloudBlue Commerce installation (see this KB article to learn more about the detachment procedure).
Important: Do not use the instructions of this article on CloudBlue Commerce installations where the Linux Qmail module has not yet been detached.
You can use the instructions of this article to prepare a mailbox for migration to another mail hosting solution, as well as for maintenance purposes.
To help you reset the password of a mailbox, a script is provided in the internal part of the article.
Prerequisites
To run the script, you need the following:
- A host where Python 2.6 or 2.7 is installed.
- The Python module ldap3 is installed on the host.
- LDAP connections from the host to the LDAP server where mailbox access data is stored are allowed.
Running the Script
To reset the password of a mailbox, run the script with the following options:
-
--ldap-server
– The IP address or FQDN of the LDAP server where mailbox access data is stored.
-
--login
– (Optional) The name of the user associated with the mailbox. The script uses the value that you specify to find and update the mailbox that you need.
-
--email
– (Optional) An email address associated with the mailbox. The script uses the value that you specify to find and update the mailbox that you need.
-
--password
– A new password to be set for the mailbox.
-
--root-dn
– (Optional) The rootDN account of the LDAP server. cn=admin,dc=pem,dc=swsoft,dc=com is used by default. You can find the actual rootDN account by running the following command on the LDAP server:
# grep rootdn /etc/openldap/slapd.conf
-
--root-dn-password
– The password of the rootDN account. You can find the password of the rootDN account by running the following command on the LDAP server:
# grep rootpw /etc/openldap/slapd.conf
-
--suffix
– (Optional) The location where the search of the mailbox starts. dc=pem,dc=swsoft,dc=com is used by default. You can find the actual location by running the following command on the LDAP server:
# grep suffix /etc/openldap/slapd.conf
Note: To find and update the mailbox that you need, you can specify --login
and --email
, only --login
, or only --email
.
For instance, you can run the script in the following way:
python reset_qmail_mailbox_password.py --ldap-server ldap.provider.com --login johnsmith@customer.com --password NEW_MAILBOX_PASSWORD --root-dn-passwd ROOTDN_PASSWORD
Updating a Mailbox Password in Open-Xchange
For a Linux Qmail mailbox integrated with the Open-Xchange service, after you set a new password for that mailbox, you need to set the same password in Open-Xchange. This can be done in the following way:
-
Obtain the access information of the Open-Xchange context that the mailbox belongs to:
- Log in to the customer control panel as an administrator of the account that the mailbox belongs to. Then, if the account has several subscriptions, select the subscription that the mailbox belongs to.
-
On the Open-Xchange screen, in the Settings section of the Open-Xchange context tab, obtain and write down the values of the following settings:
- Context ID
- Administrator login
- Administrator password
Log in to the server where Open-Xchange is installed.
-
Obtain the identifier of the respective mailbox user by running the following command:
/opt/open-xchange/sbin/listuser -c <Context ID> -A <Administrator login> -P <Administrator password>
For example:
[root@OX ~]# /opt/open-xchange/sbin/listuser -c 123 -A e971mail95841962 -P AQoCroJK6C
Id Name Displayname Email
...
3 johnsmith@example.com John Smith johnsmith@example.com
...
-
Set the same password for the respective mailbox user by running the following command:
/opt/open-xchange/sbin/changeuser -c <Context ID> -A <Administrator login> -P <Administrator password> -i <User ID of mailbox user> -p <New password of mailbox user>
For example:
[root@OX ~]# /opt/open-xchange/sbin/changeuser -c 123 -A e971mail95841962 -P AQoCroJK6C -i 3 -p e04a125c0e46450ebd4fbc03973f2c70
user 3 in context 123 changed
Internal Content
See this article