add notes

This commit is contained in:
Paul Trowbridge 2019-03-30 02:28:55 -04:00
parent 7abcb40a35
commit 9f99de4c66
3 changed files with 50 additions and 14 deletions

View File

@ -1,8 +1,8 @@
DROP USER IF EXISTS report;
DROP USER IF EXISTS api;
SET password_encryption = 'scram-sha-256';
CREATE ROLE report WITH
CREATE ROLE api WITH
LOGIN
NOSUPERUSER
NOCREATEDB
@ -10,30 +10,30 @@ CREATE ROLE report WITH
INHERIT
NOREPLICATION
CONNECTION LIMIT -1
PASSWORD 'report';
PASSWORD 'api';
--------------------grant--------------------------------------------------
GRANT USAGE ON SCHEMA lgdat TO report;
GRANT USAGE ON SCHEMA lgdat TO api;
GRANT SELECT /*, UPDATE, INSERT, DELETE*/ ON ALL TABLES IN SCHEMA lgdat TO report;
GRANT SELECT /*, UPDATE, INSERT, DELETE*/ ON ALL TABLES IN SCHEMA lgdat TO api;
GRANT USAGE ON ALL SEQUENCES IN SCHEMA lgdat TO report;
GRANT USAGE ON ALL SEQUENCES IN SCHEMA lgdat TO api;
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat GRANT SELECT/*, UPDATE, INSERT, DELETE*/ ON TABLES TO report;
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat GRANT SELECT/*, UPDATE, INSERT, DELETE*/ ON TABLES TO api;
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat GRANT USAGE ON SEQUENCES TO report;
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat GRANT USAGE ON SEQUENCES TO api;
---------------------------revoke---------------------------------------
REVOKE USAGE ON SCHEMA lgdat FROM report;
REVOKE USAGE ON SCHEMA lgdat FROM api;
REVOKE USAGE ON SCHEMA lgdat FROM report;
REVOKE USAGE ON SCHEMA lgdat FROM api;
REVOKE SELECT , UPDATE, INSERT, DELETE ON ALL TABLES IN SCHEMA lgdat FROM report;
REVOKE SELECT , UPDATE, INSERT, DELETE ON ALL TABLES IN SCHEMA lgdat FROM api;
REVOKE USAGE ON ALL SEQUENCES IN SCHEMA lgdat FROM report;
REVOKE USAGE ON ALL SEQUENCES IN SCHEMA lgdat FROM api;
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat REVOKE SELECT, UPDATE, INSERT, DELETE ON TABLES FROM report;
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat REVOKE SELECT, UPDATE, INSERT, DELETE ON TABLES FROM api;
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat REVOKE USAGE ON SEQUENCES FROM report;
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat REVOKE USAGE ON SEQUENCES FROM api;

24
ubuntu/systemd.md Normal file
View File

@ -0,0 +1,24 @@
save in //etc/systemd/system/this_file.service
```
[Unit]
Description=Redis persistent key-value database
After=network.target
[Service]
ExecStart=/usr/bin/node //var/wwww/forecast_api/index.js
User=fc
Restart=always
StandardOutput=syslog
StandardError=syslog
WorkingDirectory=//var/www/forecast_api
[Install]
WantedBy=multi-user.target
```
`sudo systemctl daemon-reload`
`sudo systemctl enable forecast_api`
https://www.axllent.org/docs/view/nodejs-service-with-systemd/

12
ubuntu/users.md Normal file
View File

@ -0,0 +1,12 @@
add a new user and then add to multiple groups
`adduser user_name`
`usermod -a -G adm,sudo user_name`
`chfn` -> changes full name
change a ownership
`chown file_or_dir user_name`
`chgrp file_or_dir user_name`
delete user
`userdel user_name`