简体   繁体   中英

Setting PostgreSQL privileges for a remote connection

I want to set a user which I can use remote, that for a database can:

  • do any rows operations
  • can't add new columns
  • can't delete/create database or tables
  • I don't want the user to have access to other databases

I executed:

GRANT ALL PRIVILEGES ON DATABASE "example" to user_name;
REVOKE CREATE ON DATABASE "example" FROM user_name;

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO user_name;

The following fails:

REVOKE CREATE ALL TABLES IN SCHEMA public FROM user_name;

    invalid privilege type CREATE for relation

Can you, please, add all necessary steps.

Also,:

  1. some help to what to set in pg_admin drop, to import only data remotely.
  2. In Ubuntu set/activate full search

You probably want to keep the user from crating tables in schema public .

For that, you must revoke the CREATE privilege on that schema which is by default granted to everybody:

REVOKE CREATE ON SCHEMA public FROM PUBLIC;

If you want to user to have permissions on tables that will be created in the future, consider using ALTER DEFAULT PRIVILEGES .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM