Project

General

Profile

adding a database user

  1. $ ssh -t vegbiendev.nceas.ucsb.edu 'exec sudo -u aaronmk -i'
  2. generate a temporary password:
    $ apg
  3. create a database account for them:
    1. $ sudo -E -u postgres psql <<<"CREATE ROLE username IN ROLE bien_read NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB LOGIN NOREPLICATION PASSWORD 'temporary_password';"
      (substitute username and temporary_password)
    2. $ rm=1 backups/users.sql.run
  4. test that they can log in:
    $ psql -h vegbiendev.nceas.ucsb.edu -U username -d vegbien <<<"SELECT * FROM analytical_stem LIMIT 1;"
    (substitute username)
  5. send them a welcome e-mail with login instructions
  6. 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