add notes
This commit is contained in:
parent
7abcb40a35
commit
9f99de4c66
@ -1,8 +1,8 @@
|
|||||||
DROP USER IF EXISTS report;
|
DROP USER IF EXISTS api;
|
||||||
|
|
||||||
SET password_encryption = 'scram-sha-256';
|
SET password_encryption = 'scram-sha-256';
|
||||||
|
|
||||||
CREATE ROLE report WITH
|
CREATE ROLE api WITH
|
||||||
LOGIN
|
LOGIN
|
||||||
NOSUPERUSER
|
NOSUPERUSER
|
||||||
NOCREATEDB
|
NOCREATEDB
|
||||||
@ -10,30 +10,30 @@ CREATE ROLE report WITH
|
|||||||
INHERIT
|
INHERIT
|
||||||
NOREPLICATION
|
NOREPLICATION
|
||||||
CONNECTION LIMIT -1
|
CONNECTION LIMIT -1
|
||||||
PASSWORD 'report';
|
PASSWORD 'api';
|
||||||
|
|
||||||
--------------------grant--------------------------------------------------
|
--------------------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---------------------------------------
|
||||||
|
|
||||||
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
24
ubuntu/systemd.md
Normal 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
12
ubuntu/users.md
Normal 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`
|
Loading…
Reference in New Issue
Block a user