Changes

Jump to navigation Jump to search
no edit summary
psql -h 128.32.252.201 -U ed_egan test
 
==Adding Users==
 
===Adding Root Accounts to the box===
 
Assuming that you have root, you can create user accounts on the box and give them root too. This isn't necessary for regular users - they just need a Postgres user account (see below). To add users to the box, the process is:
 
First great the users group, checking the last group number (5xx is the next one):
cat /etc/group
/usr/sbin/groupadd -g 5xx username
 
Then add the user (it doesn't matter what you put for -p, it is going to be overwritten):
/usr/sbin/useradd -g username -G root -s /bin/bash -p xxxx -d /home/username -m username
where g is the primary group, G is other groups, p sets a password,
d declares a home directory and m makes the directory
 
Change the user's password:
passwd username
 
And add the user to the sudoers file
echo 'username ALL=(ALL) ALL' >> /etc/sudoers
 
====Deleting a user====
 
To delete a user:
/usr/sbin/userdel -r roger
where r removes the home directory
 
And to remove their group
/usr/sbin/groupdel username
 
And remove their entry from the sudoers file too if they had root.
 
===Adding Postgres Accounts===
 
Log on to the box as root then:
su postgres
 
To work as the postgres account.
 
Now add the user using:
/usr/local/pgsql/bin/createuser username
(Answer y or n to whether you want the new role to be superuser - generally y)
 
If the user doesn't have an account on the box, then you'll need to add a database for them (use DBname of 'firstname_data' as a default):
/usr/local/pgsql/bin/createdb -O username DBname
Anonymous user

Navigation menu