I have a local postgreSQL database installed on my linux computer. I would like run this database on a NAS Synology DiskStation (DS216j) instead.

I followed this guideline until step 2: http://iamsensoria.com/post/130235198606/postgres-on-synology (I am able to create the database and the user) But i am not able to do the step3.

I am trying to connect to the database with pgAdminIII but i get an error saying:

"he server doesn't accept connections: the connection library reports could not connect to server: Oppkobling nektes Is the server running on host "" and accepting TCP/IP connections on port 5432? If you encounter this message, please check if the server you're trying to contact is actually running PostgreSQL on the given port. Test if you have network connectivity from your client to the server host using ping or equivalent tools. Is your network / VPN / SSH tunnel / firewall configured correctly? For security reasons, PostgreSQL does not listen on all available IP addresses on the server machine initially. In order to access the server over the network, you need to enable listening on the address first. For PostgreSQL servers starting with version 8.0, this is controlled using the "listen_addresses" parameter in the postgresql.conf file. Here, you can enter a list of IP addresses the server should listen on, or simply use '*' to listen on all available IP addresses. For earlier servers (Version 7.3 or 7.4), you'll need to set the "tcpip_socket" parameter to 'true'. You can use the postgresql.conf editor that is built into pgAdmin III to edit the postgresql.conf configuration file. After changing this file, you need to restart the server process to make the setting effective. If you double-checked your configuration but still get this error message, it's still unlikely that you encounter a fatal PostgreSQL misbehaviour. You probably have some low level network connectivity problems (e.g. firewall configuration). Please check this thoroughly before reporting a bug to the PostgreSQL community"

ps: I have opened the port 5432 on the sinology DS-216J.

Does anybody have gone through this before? Thanks in advance.

I also use this resources:


------UPDATE 1----

ssh [email protected]
testuser@test:~$ sudo -s
sh-4.3# su - postgres
postgres@test:~$ psql
psql (9.3.14)
 Type "help" for help.
postgres=#  \l


 download         | DownloadStation 
 mediaserver    | MediaIndex      
 mydb               | postgres       
 photo               | PhotoStation    
 postgres          | postgres       
 template0        | postgres        | SQL_ASCII | C       | C     | =c/postgres   
 template1      | postgres        | SQL_ASCII | C       | C     | =c/postgres   
 usermydb       | postgres        | SQL_ASCII | C       | C     | 
 video_metadata | VideoStation    | SQL_ASCII | C       | C     | 

postgres=# \c mydb
You are now connected to database "mydb" as user "postgres".
mydb=# SHOW hba_file;
(1 row)

    mydb=# sudo vim /etc/postgresql/pg_hba.conf   // NOT WORKING
    mydb=# sudo vim /etc/postgresql/9.1/main/pg_hba.conf // NOT WORKING
  • Sounds like you may need to configure your hba.conf to allow connections in
    – ryekayo
    Commented Jul 11, 2017 at 13:19
  • How can I check if the NAS (where i have previously started the db) is actually running PostgreSQL on the given port? Commented Jul 11, 2017 at 13:41
  • Use netstat: netstat -tulnp | grep 5432
    – ryekayo
    Commented Jul 11, 2017 at 13:43
  • I have logged in first with SSH from my pc to the NAS with an active user and I get --------------------------------:testuser@test:~$ netstat -tulnp | grep 5432 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0* LISTEN Commented Jul 11, 2017 at 13:49
  • Thats your problem! netstat shows that the PID is listening to your loopback address. Which is why you need to modify your hba conf to have the PID listen to not just listen to your loopback address.
    – ryekayo
    Commented Jul 11, 2017 at 13:50

1 Answer 1


The problem is Postgres is binding to your loopback address ( This typically means that your database will not accept connections outside your loopback. It is evident based on your results running netstat.

The Solution:

You need to modify your pg_hba.conf file to allow outside connections (preferrably, your PC's IP address). Take a look at the following. I'm not 100% what version of Postgres your using but I can't imagine each version having vast differences between configuring your pg_hba.conf.

  • Ok so, to be able to modify this pg_hba.conf I will have to connect with telnet. After I modify the file my DB on the NAS can accept outside connection and eventually I will also be able to establish connection from gAdminIII. Is this correct? Commented Jul 11, 2017 at 14:51
  • Not quite. Your using telnet to test your connectivity from points A -> B. Once you modify the hba.conf and restart the daemon, you can use telnet to confirm you are able connect remotely. After which, you should be able to connect via pgAdmin
    – ryekayo
    Commented Jul 11, 2017 at 15:15
  • ok. I am understanding much more now. This is my first approach to linux. I am trying to migrate a local database which I made using pgAdminIII & LibreofficeBase to a NAS synology. If my pc has ip and my NAS has can I check the port using the command telnet 5432 ? Because i tried that (also as a root), but i just get connection refused. Commented Jul 11, 2017 at 16:09
  • 1
    I understand.. But this is stuff you need to learn and is elementary to using Linux. I would recommend learning the fundamentals first prior to installing and configuring a database server on Linux. Migrating a database to Linux w.o learning about it's features is counterproductive. The answer I posted is the reason why you can't connect to the database via pgadmin. But you need to learn how to fix it.
    – ryekayo
    Commented Jul 11, 2017 at 16:45
  • 1
    I wanted to thank you for pointing me in right direction. I have solved my problem and here i post my answer as resolution in case somebody else need it. Commented Jul 16, 2017 at 20:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .