Friday, November 03, 2017

ssh-copy-id: add authorized_keys entry automatically


Copy authorized key to remote server:
ssh-copy-id -i ~/.ssh/id_rsa example.com

-i = private key associated with the public key that you would like to copy

Saturday, June 17, 2017

Postgresql: Read-Only User



create user xxxxx with password 'yyyy';
GRANT connect ON DATABASE mydb1 TO xxxxx;
GRANT connect ON DATABASE mydb2 TO xxxxx;

\c mydb1
GRANT usage ON SCHEMA public TO xxxxx;
GRANT select ON ALL TABLES IN SCHEMA public TO xxxxx;
GRANT select ON ALL SEQUENCES IN SCHEMA public TO xxxxx;

\c mydb2
GRANT usage ON SCHEMA public TO xxxxx;
GRANT select ON ALL TABLES IN SCHEMA public TO xxxxx;
GRANT select ON ALL SEQUENCES IN SCHEMA public TO xxxxx;