원격 컴퓨터 (Ubuntu 12.04)에서 실행중인 postgresql (9.1.4) 서버가 있는데 로컬 컴퓨터에서 액세스하는 데 문제가 있습니다. 특히, 내 로컬 컴퓨터에서 사용자 이름 "postgres"와 데이터베이스 이름 "postgres"만 사용하여 원격 서버에 액세스 할 수 있습니다. 다른 사용자 이름과 데이터베이스가 있더라도. 배경 정보 중 일부. 원격 컴퓨터에서 "psql"이라는 대화 형 환경에서 호출되는 동안 "mxtxdb"라는 다른 사용자를 생성하고 해당 사용자의 비밀번호를 설정했습니다. 또한 "mxtxdb"라는 데이터베이스를 만들었습니다.원격 postgresql 서버에서 데이터베이스에 액세스 할 때의 문제
[email protected]:~$ psql -h localhost -U mxtxdb -d mxtxdb
Password for user mxtxdb:
psql (9.1.4)
Type "help" for help.
mxtxdb=>
: 아직 원격 시스템에서, 나는 "mxtxdb"PostgreSQL의 계정에서 데이터베이스에 액세스 할 수 있지만,
sudo su postgres
Password:
[email protected]:~$ psql
psql (9.1.4)
Type "help" for help.
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
mxtxdb | | {}
postgres | Superuser, Create role, Create DB, Replication | {}
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
mxtxdb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres+
| | | | | mxtxdb=CTc/postgres
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
또한 : 자신의 존재를 설명하기 위해 원격 시스템에 로그온 및 실행 내가 로컬 시스템에 동일한 작업을 수행하려고 할 때,이 얻을 :
psql -h <server's address> -U postgres -d "postgres" -p 5432
Password for user postgres:
psql (9.1.4)
Type "help" for help.
postgres=#
및
을host all mxtxdb 0.0.0.0/0 trust
host all postgres 0.0.0.0/0 trust
과 listen_addresses는 postgresql.conf 파일 '*'(및 주석)으로 설정됩니다 39,
내있는 pg_hba.conf 파일의 마지막 두 행
psql -h <server's address> -U "mxtxdb" -d "mxtxdb" -p 5432
Password for user mxtxdb:
psql: FATAL: role "mxtxdb" does not exist
은 .
다른 계정이나 데이터베이스에 원격으로 액세스 할 수없는 이유는 무엇입니까?하지만 원격 시스템에 ssh'd 할 수 있습니까?
+1 완전하고 좋은 세부 질문입니다. 고맙습니다. 그래도 즉각적인 아이디어는 없습니다. –
꽤 당연한 생각이지만 : iptables'nat' 테이블에 트래픽을 리디렉션 할 수있는 규칙이 있습니까? 'iptables -t nat -L -n'. –
또한 문제가있는 서버로 ssh하고 psql을 사용하여 로컬로 연결하는 대신'localhost' 대신 공용 IP'<서버 주소>'를 사용하면 어떻게됩니까?또한 문제가있는 클라이언트에서'tcptraceroute <서버 주소>'를 시도하십시오. –