host "msf_database" "msf_user" 127.0.0.1/32 md5 host all all 127.0.0.1/32 ident
保存后初始化数据库并启动服务,这里我直接就是root权限:
1 2 3 4 5 6 7 8 9 10
postgresql-setup initdb systemctl start postgresql.service su postgres createuser msf_user -P Enter password for new role: yourmsfpassword Enter it again: yourmsfpassword Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) n Shall the new role be allowed to create more new roles? (y/n) n createdb --owner=msf_user msf_database
然后切换回root用户,执行msfconsole:
1 2 3 4 5 6 7 8 9 10
msf> db_status [*] postgresql selected, no connection msf> db_connect msf_user:yourmsfpassword@127.0.0.1:5432/msf_database NOTICE: CREATE TABLE will create implicit sequence "hosts_id_seq" for serial column "hosts.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "hosts_pkey" for table "hosts" [..] NOTICE: CREATE TABLE will create implicit sequence "mod_refs_id_seq" for serial column "mod_refs.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "mod_refs_pkey" for table "mod_refs" msf > db_status [*] postgresql connected to msf_database