Sometimes when you are testing or setting up a server or just porting things to another server, you just want to install the same set of users as you had before without restoring any databases.
In PostgreSQL, the users (Login Roles) and group roles are stored at the server level and only the permissions to objects are stored at the database level.
How do you restore just the users and roles without having to do a full pg_dumpall of your server?
Using the Command Line:
Remember that these executables pg_dumpall, psql are located in the bin of your postgresql install
Then to restore the accounts on the new server, open up the .sql file generated and delete all the accounts and stuff you don't want to bring over.
Then just run the generate .sql file with psql something like