ALT Linux sysadmins discussion
 help / color / mirror / Atom feed
From: Anton Gorlov <stalker@altlinux.ru>
To: ALT Linux sysadmin discuss <sysadmins@lists.altlinux.org>
Subject: [Sysadmins] postgres
Date: Thu, 24 Apr 2014 17:03:14 +0400
Message-ID: <53590B92.3020205@altlinux.ru> (raw)

All - помогите с правами в postgres снятся с ручника.
Нужно запретит пользователям подключаться не к своим базам по дефолту.

postgres=# REVOKE CONNECT ON DATABASE template1 FROM PUBLIC;
REVOKE
postgres=# CREATE ROLE test NOSUPERUSER NOCREATEDB NOCREATEROLE 
NOINHERIT LOGIN ENCRYPTED PASSWORD 'test';
CREATE ROLE
postgres=# CREATE ROLE test2 NOSUPERUSER NOCREATEDB NOCREATEROLE 
NOINHERIT LOGIN ENCRYPTED PASSWORD 'test2';
CREATE ROLE
postgres=# CREATE DATABASE test2 WITH OWNER=test2;
CREATE DATABASE
postgres=# CREATE DATABASE test WITH OWNER=test;
CREATE DATABASE


psql -U test -W test
Пароль пользователя test:
psql (9.1.12)
Введите "help", чтобы получить справку.

test=> \q
psql -U test -W test2
Пароль пользователя test:
psql (9.1.12)
Введите "help", чтобы получить справку.

test2=>


Дёргать каждый раз REVOKE ALL ON DATABASE <DBNAME> FROM public;  не 
подходит. Нужно именно по дефолту  у public права урезать


                 reply	other threads:[~2014-04-24 13:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53590B92.3020205@altlinux.ru \
    --to=stalker@altlinux.ru \
    --cc=sysadmins@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux sysadmins discussion

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sysadmins/0 sysadmins/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sysadmins sysadmins/ http://lore.altlinux.org/sysadmins \
		sysadmins@lists.altlinux.org sysadmins@lists.altlinux.ru sysadmins@lists.altlinux.com
	public-inbox-index sysadmins

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sysadmins


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git