GBase 8s, the China-domestically developed OLTP database from GBASE, supports two authentication paths: operating system users and database internal users. By configuring user mapping, you can control whether non‑OS users can log in, and what privileges they inherit.
Configuring User Mapping
The USERMAPPING parameter accepts three values:
- OFF – Only OS users can connect; internal users are blocked.
- BASIC – Internal users can connect, but cannot perform privileged operations (DBSA, DBSSO, AAO) even if the mapped OS user holds those privileges.
- ADMIN – Internal users can connect and, if the mapped OS user is a privileged user, the internal user also gains those administrative capabilities.
Set it dynamically:
onmode -wf USERMAPPING='BASIC'
You also need the file /etc/gbasedbt/allowed.surrogates. A minimal version:
USERS:daemon
After changing the file, reload the cache:
onmode -cache surrogates
Creating a Default OS Mapping User
Inside the sysuser database, create a default user that internal users will map to:
CREATE DEFAULT USER WITH PROPERTIES USER daemon HOME "/home/gbasedbt/users";
Creating an Internal User and Granting Permissions
- Create the user:
CREATE USER testuser WITH PASSWORD 'testuser';
- Grant database‑level privileges (CONNECT, RESOURCE, DBA):
echo "GRANT DBA TO testuser;" | dbaccess testdb -
- Connect as an internal user:
dbaccess - -
CONNECT TO 'testdb@ol_gbasedbt1210' USER 'testuser';
Locking and Unlocking Users
Run directly as the gbasedbt OS user:
ALTER USER testuser ACCOUNT LOCK; -- lock
ALTER USER testuser ACCOUNT UNLOCK; -- unlock
OS User Access
Create an OS account and add it to the gbasedbt group:
useradd daemon
usermod -g gbasedbt daemon
Then grant database privileges from within the database:
GRANT DBA TO daemon;
To add a supplementary group instead of changing the primary group:
usermod -a -G gbasedbt daemon
Viewing User Info
Query the sysusers table; usertype values: D = DBA, C = CONNECT, etc.
SELECT * FROM sysusers;
The sysusermap table shows how internal users are mapped to OS users.
By combining OS‑level accounts with internal users and fine‑grained mapping, you can set up a gbase database access model that is both secure and flexible — well suited for independently controlled enterprise environments.
Top comments (0)