You are not logged in.

#1 2018-11-18 17:25:31

James_Eder
Member
From: usa
Registered: 2011-05-19
Posts: 14

How do I setup MariaDB authentication with PAM?

I've created a database that I'd like a normal Linux user to have access to.

I loaded the pam plugin:

MariaDB [(none)]> INSTALL SONAME 'auth_pam';

Checked with:

MariaDB [(none)]> SELECT * FROM information_schema.plugins WHERE plugin_name = 'pam'\G
*************************** 1. row ***************************
           PLUGIN_NAME: pam
        PLUGIN_VERSION: 1.0
         PLUGIN_STATUS: ACTIVE
           PLUGIN_TYPE: AUTHENTICATION
   PLUGIN_TYPE_VERSION: 2.1
        PLUGIN_LIBRARY: auth_pam.so
PLUGIN_LIBRARY_VERSION: 1.13
         PLUGIN_AUTHOR: Sergei Golubchik
    PLUGIN_DESCRIPTION: PAM based authentication
        PLUGIN_LICENSE: GPL
           LOAD_OPTION: ON
       PLUGIN_MATURITY: Stable
   PLUGIN_AUTH_VERSION: 1.0
1 row in set (0.00 sec)

Created the pam config

$ cat /etc/pam.d/mariadb
#%PAM-1.0
auth       required     pam_unix.so
account    required     pam_unix.so

Created the MariaDB user

MariaDB [(none)]> CREATE USER 'bob' IDENTIFIED WITH pam USING 'mariadb';

Granted access

MariaDB [(none)]> GRANT ALL PRIVILEGES ON `bobdb`.* TO `bob`;

But when logged in as bob:

$ mysql bobdb
[mariadb] Password:  
ERROR 1045 (28000): Access denied for user 'bob'@'localhost' (using password: NO)
$

Offline

Board footer

Powered by FluxBB