
1 1 service postgresql start 2、进入postgresql配置 1 2 1 2 sudo -u postgres psqlalter user postgres with password 'admin'; 3、修改linux系统的postgres用户的密码(密码与数据库用户postgres的密码相同)注意1:’admin’ 这个是密码。
注意2:分号!!!! 一定要带上分号”;”。
注意3:\q:退出数据库
1 2 3 4 5 6 1 2 3 4 5 6 root@kali:~# sudo passwd -d postgrespasswd:密码过期信息已更改。root# sudo -u postgres passwd输入新的 UNIX 密码:重新输入新的 UNIX 密码:passwd:已成功更新密码4、修改Postgressql数据库配置实现远程访问
1 root# vi /etc/postgresql/9.4/main/postgresql.conf 更改#Listen_addresses = 'localhost'为Listen_addresses = '*'
更改#password_encryption = on为password_encryption = on
# vi /etc/postgresql/9.4/main/pg_hba.conf
在文档末尾加上以下内容
@H_404_115@ 1 2 # to allow your clIEnt visiting postgresql serverhost all all 0.0.0.0/32 md5# service postgresql restart
5、管理Postgresql用户和数据库注意1:”#”号,一定要把”#”删除掉。
注意2:在vi编辑模式下点击键盘字母a是进入编辑模式,编辑完成后点击“esc”退出编辑模式然后在最下方输入”:wq”保存并退出。
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 root@kali:~# psql -U postgres -h 127.0.0.1用户 postgres 的口令:psql (9.4.6)SSL连接 (协议: TLSv1.2,加密:ECDHE-RSA-AES256-GCM-SHA384,二进制位: 256,压缩比: 关闭)输入 "help" 来获取帮助信息.postgres=# create user msf 'admin' nocreatedb;CREATE RolE postgres=# database msf with owner=msf;CREATE DATABASE postgres=# \q
6、msf配置连接注意1:还是要注意分号!!!没有分号命令就无法执行。
注意2:注意复制的时候”“符号问题。
注意3:user后面是用户名,password后面是用户名对应的密码。
注意4:命令执行后有返回结果才是执行成功了。
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 root# msfconsolemsf > db_status [*] postgresql selected,no connectionmsf > db_connect msf:admin@127.0.1/msf[*] Rebuilding the module cache in the background...msf > db_status [*] postgresql connected to msfmsf >
1 db_connect -y /usr/share/Metasploit-framework/config/database.yml
在msf启动后连接数据库就好。
7、配置自动连接注意1:”msf:admin”这个是步骤5中的
“create user msf with password ‘admin’ nocreatedb;”所建立的。
“127.0.0.1”是指本机。
“msf”这个是库名。
注意2:”[*] postgresql connected to msf”这个是说明以链接成功数据库。
自动连接可以通过配置文件/usr/share/Metasploit-framework/config/database.yml完成,内容可以通过复制database.yml.example并修改内容来完成设置。
1 2 3 1 2 3 root:/usr/share/Metasploit-framework/config#cp database.yml.example database.ymlroot#vi database.ymlroot#cat database.yml
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 development: &pgsql adapter: postgresql database: msf username: msf password: admin host: localhost port: 5432 pool: 5 timeout: 5
主要改database、password、host这三个值
重新执行msfconsole即可直接链接数据库
总结以上是内存溢出为你收集整理的kali2.0配置msf连接postgresql数据库全部内容,希望文章能够帮你解决kali2.0配置msf连接postgresql数据库所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)