设为首页 加入收藏

TOP

Backtrack5的Postpresql的使用(一)
2014-11-24 07:52:57 来源: 作者: 【 】 浏览:0
Tags:Backtrack5 Postpresql 使用
Backtrack5的Postpresql的使用
在使用Backtrack5的Postpresql时发现没法正常连接进去,出现如下错误
------------------------------------------------
www.2cto.com
msf > db_connect postgres:toor@127.0.0.1/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
-------------------------------------------------
从这里我们看出 www.2cto.com
db_connect命令 默认去连接 5432接口,而我们可以通过多种方式看到开启的端口其实是 7337 【1】 root@bt:~# ps -ef|grep post
root 3554 1 0 19:50 tty1 00:00:13 gedit /opt/met asploit/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
/opt/metasploit/postgresql/scripts/ctl.sh : postgresql stopped
LOG: database system was shut down at 2013-03-02 20:45:52 CST
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
/opt/metasploit/postgresql/scripts/ctl.sh : postgresql started at port 7337
---------------------------------------------------------
接着用psql连接去连接发现
root@bt:~# psql
程序“psql”尚未安装。 您可以使用以下命令安装:
--------------------------------------------------------
然后安装
root@bt:~# apt-get install postgresql-client-common
-------------------------------------------------------
安装完后发现还是有问题
Error: You must install at least one postgresql-client- package.
奇怪了,这个时候去查看安装的依赖包关系
root@bt:~# apt-get install postgresql libpq-dev
下列软件包有未满足的依赖关系:
libpq-dev: 依赖: libpq5 (= 8.4.8-0ubuntu0.10.04) 但是 8.4.12-0ubuntu10.04 正要被安装
被打败了。。。。。果断执行
root@bt:~# sudo apt-get install postgresql-8.4 postgresql-client-8.4
-----------------------------------------------------
这个时候发现其实已经重装好了postgresql了,版本是8.4
用命令重新启动:/etc/init.d/postgresql-8.4 restart
root@bt:/etc/init.d# sudo su postgres -c psql
psql (8.4.8)
Type "help" for help.
postgres=# ALTER USER postgres WITH PASSWORD 'Test12345';
ALTER ROLE
postgres-# \q
could not save history to file "/home/postgres/.psql_history": No such file or directory
root@bt:/etc/init.d# sudo passwd -d postgres
passwd: password expiry information changed.
root@bt:/etc/init.d# sudo su postgres -c passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
----------------------------------------------------
root@bt:/etc/init.d# update-alternatives --config ruby
There are 2 choices for the alternative ruby (provi
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇DBA_ENABLED_TRACES 下一篇本地yum源配置方法二则

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·求navicat for mysql (2025-12-26 13:21:33)
·有哪位大哥推荐一下m (2025-12-26 13:21:30)
·MySQL下载与安装教程 (2025-12-26 13:21:26)
·Linux_百度百科 (2025-12-26 12:51:52)
·Shell 流程控制 | 菜 (2025-12-26 12:51:49)