I've installed postgresql 9.3, but can't get any users authorized. I also can't use initdb or pg_ctl. I can't find pg_hba.conf either.
pg_hba.conf file resides:
pg_hba.conf is in
X.Y is your version, 9.3 for you, 9.4 for me).
pg_ctl may not be installed by default.
initdb may also not be installed by default. Both are installable by
Adding users so they can be authorized:
You'll have to add a user/role in via the
psql command line client. You'll then have to add the user to
I suggest using
pgadmin3, a graphical interface/program, to work with user roles and adding them. It allows you to specifically select the individual permissions you want to give a user globally (which should usually be no special permissions, just to create the user, and give permissions for a given DB separately).
This can be a little tricky. Once you've got a user login role, you need to add them to
pg_hba.conf. The format of the file is fully explained in detail in the PosgreSQL documentation. A short summary is here.
Unless there is a matching line here, the default access rule is "deny access".
This is the format of a
TYPE DATABASE USER ADDRESS METHOD
type is the type of connection. Local connections from the same computer get the
local type. Connections from a non-local IP (i.e. over TCP) get the
hostnossl can be used instead, and will identify any network connection to it (i.e. non-local) that is not over SSL.
hostssl can be used to specify any network connection that is over SSL, however it is not default to have SSL set up.
database is self-explanatory - what database do you want to set these access permissions/restrictions to. A special database type is
all which indicates all databases.
user is the username / role that you've added to Postgres. It has to exist within postgres, and it may need to exist as a local system user (however that's explained in where I explain
ADDRESS is an IPv4 or IPv6 address or range. It is only to be used when
hostssl are specified under
type. It can be a CIDR range or an individual IP address.
METHOD is how to handle authentication.
- For a local user with the
localtype, it should be
md5authentication if you want the user to be able to login from a different local computer user account with a password.
- For a
hostnosslconnection type, you probably want to use
md5here, however you may have other types of authentication (see the documentation link above).
- Under no circumstances unless you are insane or really know what you are doing should you use the
trustmethod. This has zero authentication of the person and is a security hole from Hell, even for
I advise you to read through the linked documentation on the
pg_hba.conf file, it's a better explanation of things.