Original article: http://www.cnblogs.com/xinyaping/archive/2011/04/15/2089081.html
Environment: Ubuntu 12.04 + PostgreSQL 9.1
PostgreSQL is installed by default using the dpkg-I command. The file paths of other installation methods may be different. If you cannot find the configuration file, use find/-name "..." to find it.
1. Edit pg_cmd.conf and configure the user's access permissions.
Vim/etc/PostgreSQL/9.1/main/pg_assist.conf
As follows:
# "Local" is for Unix domain socket connections only
Local all ident
# IPv4 local connections:
Host All all 127.0.0.1/32 MD5
Host All all 172.16.230.0/24 MD5
Host All all 192.168.98.0/24 MD5
The two rows marked in bold are added by me. These two rows allow users of the two network segments to access the database.
2. Edit PostgreSQL. conf to enable the database server to listen to connection requests from all hosts.
VI/etc/PostgreSQL/9.1/main/PostgreSQL. conf
As follows:
Find the line listen_addresses = 'localhost' and change it:
Listen_addresses = '*'
This line is usually commented out. Remove the annotator "#" to make this line take effect.
After restarting the database service, you can use clients such as pgadmin3 to remotely access the database.