简体   繁体   中英

open/forwarding port in debian

I want to connect postgres that is in my vps (debian), from my pc with pgadmin3. my problem is that port 5432 is not open! I tried to open it with this command

iptables -A INPUT -p tcp --dport 5432 -j ACCEPT

but my problem didn't solve!

aminpy@lenovo ~ $ telnet vps_ip 5432
Trying vps_ip...
telnet: Unable to connect to remote host: Connection refused

can anybody help me?

It probably isn't a good idea to open that port to everyone on the internet. I would use a SSH port forward instead which will pass all data transparently through an encrypted tunnel. Use a command like this:

ssh -L 15432:localhost:5432 vps-host

Connections to port 15432 on your machine will then be forward to port 5432 on vps-host. Note that the localhost in the command is the hostname as seen from vps-host, not your client machine.

See the man page for ssh for more info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM