1

そのため、Mac 10.9 Mavericks マシンで metasploit で使用できるように PostgreSQL をセットアップしようとしています。このページで概説されている指示に従おうとしています。 http://www.darkoperator.com/installing-metasploit-framewor/そして私はコマンドに行きました:

createuser msf -P -h localhost

結果は次のとおりです。

$ createuser msf -P -h localhost
Enter password for new role: 
Enter it again: 
createuser: could not connect to database postgres: FATAL:  no pg_hba.conf entry for host "127.0.0.1", user "myname", database "postgres", SSL off

ここに自分の名前を載せたくないので、「私の名前」と書かれている部分をそれに変更しました。これに対する解決策を求めて数日間インターネットを検索しましたが、pg_hba.conf を編集する必要があると確信しています。これが私のpg_hba.confファイルの内容です:

 80 # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
 81 
 82 # "local" is for Unix domain socket connections only
 83 #local   all         all                               trust
 84 host     all         all        0.0.0.0/0             md5
 85 local   all         all                               md5
 86 # IPv4 local connections:
 87 host    all         all         127.0.0.1/32          md5
 88 # IPv6 local connections:
 89 host    all         all         ::1/128               md5
 90 
 91 # TYPE  DATABASE        USER            ADDRESS                 METHOD
 92 #local   postgres        postgres                                trust
 93 #local   msf_db          msf_user                                trust
 94 # Allow replication connections from localhost, by a user with the
 95 # replication privilege.
 96 #local   replication     postgres                                trust
 97 #host    replication     postgres        127.0.0.1/32            trust
 98 #host    replication     postgres        ::1/128                 trust

postgresql を起動して実行するには、このセクションに何を追加/削除 (コメントアウト) する必要があるか教えていただけますか?

これを解決する方法を学ぶのに役立つ情報がさらに必要な場合はお知らせください。ありがとうございました!!

編集1:

データベースを再起動するだけでよいと言われましたが、次のようになりました。

sh-3.2# pg_ctl stop -D /opt/local/var/db/postgresql93/defaultdb
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.

これを完了するためにsuとしてログインしました...

編集2:

次に、デフォルトのユーザーを使用してこれを完了しようとしましたが、これが得られたものです(自分で正しいパスワードを入力したと確信しています)

sxxx:~ sxxx$ createuser msf -P -h localhost
Enter password for new role: 
Enter it again: 
Password: 
createuser: could not connect to database postgres: FATAL:  password authentication failed for user "sxxx"

編集3:

他の何人かの助けのおかげで、これを作成するには postgres ユーザーにログインする必要があることがわかりました。私はまだこれを完了することができません。ここで私がしたことは次のとおりです。

Sxxx-MacBook-Pro:~ sxxx$ sudo su - postgres
Sxxx-MacBook-Pro:~ postgres$ createuser msf -P -h localhost
Enter password for new role: 
Enter it again: 
createuser: could not connect to database postgres: FATAL:  role "postgres" does not exist

私には奇妙に思えます。

編集4:

奇跡的に端末ウィンドウを閉じて新しいウィンドウを開くと、これまでずっと行っていたのと同じことが機能しました。

Sxxx-MacBook-Pro:~ sxxx$ createuser msf -P -h localhost
Enter password for new role: 
Enter it again: 
Sxxx-MacBook-Pro:~ sxxx$ createdb -O msf msf -h localhost
Sxxx-MacBook-Pro:~ sxxx$ 
4

1 に答える 1

0

PostgreSQL が実行されているユーザーを確認します。通常、これはpgsqlまたはになりますpostgrescreateuserそのユーザーとしてコマンドを実行します。

$ sudo su
# su postgres -c 'createuser msf -P -h localhost'

おそらく、ファイルに触れる必要はありませんpg_hba.conf

于 2015-03-09T01:19:49.357 に答える