Possibility to change SQL script after create new database by user?

hockolicious

Verified User
Joined
Jun 20, 2019
Messages
61
Location
Poland
Hello,

In directadmin is possibility to change sql query script after creating database with user by directadmin user? I wan't to add 1 more hosts to users, now I have only localhost.
 

Zhenyapan

Verified User
Joined
Feb 23, 2018
Messages
379
Location
UA
log in as user that created database, in "MySQL Management" click at database name, there you can see "Access Hosts" just add there all you want.
 

hockolicious

Verified User
Joined
Jun 20, 2019
Messages
61
Location
Poland
Of course, I know how to add remote hosts manually. I am interested in editing the global script, which is responsible for generating the database and creating the user - so as to add a remote host at this level and block the possibility of its removal by the user.
 

Zhenyapan

Verified User
Joined
Feb 23, 2018
Messages
379
Location
UA
In such case you must create databases manually, and disable GRANT for this user.
For automatical database creation you can use:
user_create_post.sh or domain_change_post.sh located in: /usr/local/directadmin/scripts/custom/
 

hockolicious

Verified User
Joined
Jun 20, 2019
Messages
61
Location
Poland
Maybe I still don't understand how it works in the user_create_post script? Do you have any examples that illustrate the situation when a user creates a database and a user and you automatically add him additional rights or a host? I want the script to download data given in the panel such as name, user, password. I am only interested in adding the external IP address and blocking it from being removed from the panel.
 

Zhenyapan

Verified User
Joined
Feb 23, 2018
Messages
379
Location
UA
panel works with da_admin (mysql root) privileges, so user always can change db-user attributes.
In such case you must create database or via console without user access to modify db-user attributes, or you can create another directadmin account and create all limited databases via regular MysqlManagement, add hosts, disable GRANT, and give credentials to user.
user_create_post.sh - it's a regular shell (bash) script which runs on every user creation.
 

hockolicious

Verified User
Joined
Jun 20, 2019
Messages
61
Location
Poland
Okay, then we forgot to lock this from user panel but how I can add another host when user create a database? Any examples?
 

Zhenyapan

Verified User
Joined
Feb 23, 2018
Messages
379
Location
UA
Through user's Mysql Management, or via mysql command like: GRANT ALL ON *.* TO 'myuser'@'another.host';
 

hockolicious

Verified User
Joined
Jun 20, 2019
Messages
61
Location
Poland
I know a basic SQL Query but I need a example in custom directadmin script to automate this when user's creating database/user
 
Top