I will not write much but just the code required to create a user and let the user access the db.
Create UserCREATE USER tom WITH PASSWORD 'myPassword';
Create a DBCREATE DATABASE jerry;
Grant Privileges to user on the DBGRANT ALL PRIVILEGES ON DATABASE jerry to tom;
Grant Privileges to table
GRANT ALL PRIVILEGES ON TABLE side_adzone TO tom;
Grant Privileges to user for copying files (especially import csv to DB)
GRANT pg_read_server_files TO tom;
Change ownership of the DBALTER DATABASE jerry OWNER TO tom;
Delete userDROP USER tom;
Update user password
ALTER USER user_name WITH PASSWORD 'new_password';
Drop DBDROP DATABASE jerry;
Backup and Restore databases
To take a backup use this command. The following command works only with postgres user so first change the user to postgres su postgres
and then dump. make sure the directory is writable by postgres user.pg_dump db_name > db_name.sql
To restore run the command as postgres userpsql db_name < db_name.sql