diff --git a/postgres/user.sql b/postgres/user.sql index 30124c6..18b58f1 100644 --- a/postgres/user.sql +++ b/postgres/user.sql @@ -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; diff --git a/ubuntu/systemd.md b/ubuntu/systemd.md new file mode 100644 index 0000000..19a12fc --- /dev/null +++ b/ubuntu/systemd.md @@ -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/ \ No newline at end of file diff --git a/ubuntu/users.md b/ubuntu/users.md new file mode 100644 index 0000000..bad23f0 --- /dev/null +++ b/ubuntu/users.md @@ -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` \ No newline at end of file