简体   繁体   English

在debian中开放/转发端口

[英]open/forwarding port in debian

I want to connect postgres that is in my vps (debian), from my pc with pgadmin3. 我想用pgadmin3从我的PC连接vps(debian)中的postgres。 my problem is that port 5432 is not open! 我的问题是5432端口未打开! 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. 我会改用SSH端口转发,它将通过加密隧道透明地传递所有数据。 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. 然后,与您计算机上的端口15432的连接将转发至vps-host上的端口5432。 Note that the localhost in the command is the hostname as seen from vps-host, not your client machine. 请注意,命令中的localhost是从vps-host看到的主机名,而不是客户端计算机。

See the man page for ssh for more info. 有关更多信息,请参见ssh的手册页。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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