postgres@kali:~$
createuser -P king_phisher
Enter password for new role:
Enter it again:
postgres@kali:~$
createdb -T template0 -E UTF-8 -O king_phisher king_phisher
postgres@kali:~$
exit
In the example above, the -P option asks
createuser
to query for a password once it creates the
new king_phisher user. Looking at the
createdb
command, the -O defines the user owning the
new database (which will thus have full rights to create tables and grant permissions and so on).
We also want to be able to use Unicode strings, so we add the -E UTF-8 option to set the encoding,
which in turn requires us to use the -T option to pick another database template.
We can now test that we can connect to the database over the socket listening on localhost (-h
localhost) as the king_phisher user (-U king_phisher):
#
psql -h localhost -U king_phisher king_phisher
Password for user king_phisher:
psql (9.5.2)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256,
å
compression: off)
Type ”help” for help.
king_phisher=>
As you can see, the connection was successful.