How to get system users list for all Plesk subscriptions

Follow

Comments

3 comments

  • Avatar
    Michel Otte (Edited )

    The query is wrong, it should be something like:

        select d.name, u.login from hosting h, domains d, sys_users u where d.id = h.dom_id and d.id = h.dom_id and h.sys_user_id = u.id

  • Avatar
    Michel Otte

    Or, if you prefer ANSI-92 SQL join syntax:

        select name, login from domains inner join hosting on domains.id = hosting.dom_id inner join sys_users on hosting.sys_user_id = sys_users.id where domains.id = hosting.dom_id

  • Avatar
    Ivan Postnikov

    Hello @Michel,

    I have checked the queries from the article and they work as expected:

    # plesk db "select name, login from domains inner join sys_users on domains.id = sys_users.id"
    +---------------+-----------+
    | name | login |
    +---------------+-----------+
    | example.com | jdoe |
    | plesktest.tld | plesktest |

     

    MariaDB [psa]> select name, login from domains inner join sys_users on domains.id = sys_users.id;
    +---------------+-----------+
    | name | login |
    +---------------+-----------+
    | example.com | jdoe |
    | plesktest.tld | plesktest |

     

    The query you provided gives a list of domains, not subscriptions:
    MariaDB [psa]> select name, login from domains inner join hosting on domains.id = hosting.dom_id inner join sys_users on hosting.sys_user_id = sys_users.id where domains.id = hosting.dom_id;
    +---------------+-----------+
    | name | login |
    +---------------+-----------+
    | plesktest.tld | plesktest |
    | example.com | jdoe |
    | example.net | jdoe |

Please sign in to leave a comment.

Have more questions? Submit a request