2017-05-13 19:48:38 +02:00
## mailcow Admin Account
2017-05-06 18:24:40 +02:00
2017-10-09 20:29:37 +02:00
Reset mailcow admin to `admin:moohoo` . Older mailcow: dockerized installations may find `mailcow-reset-admin.sh` in their mailcow root directory (mailcow_path).
2017-05-06 18:24:40 +02:00
```
cd mailcow_path
2017-10-09 20:29:37 +02:00
./helper-scripts/mailcow-reset-admin.sh
2017-05-06 18:24:40 +02:00
```
2017-05-06 19:09:57 +02:00
## Reset MySQL Passwords
2017-05-06 18:24:40 +02:00
2017-05-06 19:09:57 +02:00
Stop the stack by running `docker-compose stop` .
When the containers came to a stop, run this command:
```
docker-compose run --rm --entrypoint '/bin/sh -c "gosu mysql mysqld --skip-grant-tables & sleep 10 & & mysql -hlocalhost -uroot & & exit 0"' mysql-mailcow
```
### 1\. Find database name
```
2017-05-06 22:32:10 +02:00
# source mailcow.conf
# docker-compose exec mysql-mailcow mysql -u${DBUSER} -p${DBPASS} ${DBNAME}
2017-05-06 19:09:57 +02:00
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mailcow_database | < =====
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
```
### 2\. Reset one or more users
2020-10-02 14:17:54 +02:00
#### 2\.1 Maria DB < 10.4 (older mailcow installations)
2017-05-06 19:09:57 +02:00
Both "password" and "authentication_string" exist. Currently "password" is used, but better set both.
```
MariaDB [(none)]> SELECT user FROM mysql.user;
+--------------+
| user |
+--------------+
2020-10-02 14:17:54 +02:00
| mailcow | < =====
2017-05-06 19:09:57 +02:00
| root |
+--------------+
2 rows in set (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
2019-08-08 15:12:23 +02:00
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('gotr00t'), password = PASSWORD('gotr00t') WHERE User = 'root';
2017-05-06 19:09:57 +02:00
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('mookuh'), password = PASSWORD('mookuh') WHERE User = 'mailcow' AND Host = '%';
MariaDB [(none)]> FLUSH PRIVILEGES;
```
2017-05-06 22:32:10 +02:00
2020-10-02 14:17:54 +02:00
#### 2\.2 Maria DB >= 10.4 (current mailcows)
```
MariaDB [(none)]> SELECT user FROM mysql.user;
+--------------+
| user |
+--------------+
| mailcow | < =====
| root |
+--------------+
2 rows in set (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
2020-10-02 14:18:18 +02:00
MariaDB [(none)]> ALTER USER 'mailcow'@'%' IDENTIFIED BY 'mookuh';
MariaDB [(none)]> ALTER USER 'root'@'%' IDENTIFIED BY 'gotr00t';
MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'gotr00t';
2020-10-02 14:17:54 +02:00
MariaDB [(none)]> FLUSH PRIVILEGES;
```
2017-05-06 22:32:10 +02:00
## Remove Two-Factor Authentication
2017-05-09 17:54:50 +02:00
This works similar to resetting a MySQL password, now we do it from the host without connecting to the MySQL CLI:
2017-05-06 22:32:10 +02:00
```
source mailcow.conf
2017-05-08 18:18:53 +02:00
docker-compose exec mysql-mailcow mysql -u${DBUSER} -p${DBPASS} ${DBNAME} -e "DELETE FROM tfa WHERE username='YOUR_USERNAME';"
2017-05-06 22:32:10 +02:00
```