firebirdfirebird2.5ibexpert

Firebird DDL for user and privileges


I have Firebird 2.5 and I need to extract all user and privileges as DDL to export to another Firebird database.

For example, I need get the script for user max

"Create user max  FIRSTNAME 'Max' LASTNAME 'Power' Grant admin option";

I use IB Expert, but did not find this option to extract the DDL.


Solution

  • Tools -> Grants/Rights Manager -> Toolbar -> Save -> To Script Executive

    IB Expert

    Alternatively, go to the Tools -> Extract Metadata -> Settings and down there check the "extract grants" checkbox.


    You also have to remember that users themselves do not exist in the database (only grants do), users they exist in the server, not the database.

    See how to display and set user rights in firebird database

    Also see GSEC documentation:

    gsec -user sysdba -password <password> -database <databasename> -display - a command like that should display all the users registered with the server used to connect to the database. It would be trivial to take the user list and add the create user command to every one.


    There is one more niche case that Firebird might have no any users, borrowing them from the host operating system. It is called "Trusted Authentication" mode. If GSEC would show no users or too few ones - check authentication settings in the relevant firebird.conf, maybe you would have to dump users list from Windows, not from Firebird.