adding a database user¶
$ ssh -t vegbiendev.nceas.ucsb.edu 'exec sudo -u aaronmk -i'
- generate a temporary password:
$ apg
- create a database account for them:
$ sudo -E -u postgres psql <<<"CREATE ROLE username IN ROLE bien_read NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB LOGIN NOREPLICATION PASSWORD 'temporary_password';"
(substituteusername
andtemporary_password
)$ rm=1 backups/users.sql.run
- test that they can log in:
$ psql -h vegbiendev.nceas.ucsb.edu -U username -d vegbien <<<"SELECT * FROM analytical_stem LIMIT 1;"
(substituteusername
) - send them a welcome e-mail with login instructions
- send them an e-mail with the subject "temporary password" containing their temporary password
- the subject is necessary to prevent the e-mail from ending up in people's spam folder