Backtrack5的Postpresql的使用
在使用Backtrack5的Postpresql时发现没法正常连接进去,出现如下错误
-----------------------------------------------------------------------------------------------------
msf > db_connect postgres:[email protected]/msfbook
[-] Error while running command db_connect: Failed to connect to the database: could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
-----------------------------------------------------------------------------------------------------
从这里我们看出
db_connect命令
默认去连接
5432接口,而我们可以通过多种方式看到开启的端口其实是
7337
【1】
root@bt:~# ps -ef|grep post
root 3554 1 0 19:50 tty1 00:00:13 gedit /opt/metasploit/postgresql/data/pg_hba.conf
postgres 4980 1 0 21:11 pts/2 00:00:00 /opt/metasploit/postgresql/bin/postgres.bin -D /opt/metasploit/postgresql/data -p 7337
【2】/opt/metasploit/postgresql/data/postgresql.conf文件里有
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '*'# what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
# (change requires restart)
#port = 7377# (change requires restart)
max_connections = 100# (change requires restart)
【3】/etc/init.d/metasploit-postgres restart
LOG: received smart shutdown request
LOG: autovacuum launcher shutting down
LOG: shutting down
LOG: database system is shut down<