2015-04-24 28 views
0

在一片虛弱中,我怯懦地遵循tutorial關於如何通過繞過公共圖書館的Wifi ssh限制連接到我的Amazon EC2遠程服務器。在遠程服務器的sshd_config中添加了Listen 443。爲什麼我不能ssh -p 443/22?

我這樣做了第一件事就是加入以下(最後)線到我的/ etc/ssh/sshd_config文件駐留在我的遠程EC2亞馬遜服務器:

# Use these options to restrict which interfaces/protocols sshd will bind to 
#ListenAddress :: 
#ListenAddress 0.0.0.0 
ListenAddress 443 

然後我重新啓動SSH服務器,並在一個天才的舉動,從我的遠程服務器註銷。所以,當我在本地機器上我做到這一點...

$ ssh -i /path/to/key.pem [email protected] -p 443 -v 

...我得到這個:

$ ssh -i /path/to/key.pem [email protected] -v -p 443 
OpenSSH_6.0p1 Debian-4+deb7u2, OpenSSL 1.0.1e 11 Feb 2013 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for * 
debug1: Connecting to xx.xx.xxx.xx [xx.xx.xxx.xx] port 443. 
debug1: connect to address xx.xx.xxx.xx port 443: Connection timed out 
ssh: connect to host xx.xx.xxx.xx port 443: Connection timed out 

如果我嘗試ssh到默認的22端口,我得到這樣的:

OpenSSH_6.0p1 Debian-4+deb7u2, OpenSSL 1.0.1e 11 Feb 2013 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for * 
debug1: Connecting to xx.xx.xxx.xx [xx.xx.xxx.xx] port 22. 
debug1: connect to address xx.xx.xxx.xx port 22: Connection refused 
ssh: connect to host xx.xx.xxx.xx port 22: Connection refused 

我還添加了在我的亞馬遜的EC2的安全組「下面的行...

Custom TCP port 443 

...無濟於事。

我是否有效地將我鎖定在遠程服務器之外?我正在關注如何隧道的教程,然後發生了這種情況。不應該剛添加到/ etc/ssh/sshd_config ...

Port 443 

...而不是'ListenAddress 443'?

我從來沒有遇到問題ssh'ing我的遠程服務器(這是一個Debian Wheezy)。

據我所知,我仍然可以分離我的音量,重新將它連接到一個新的實例,修復sshd_config文件等。我希望有一個替代方案。

所以我的問題是:可以連接到我的遠程服務器,考慮ssh_config中的'ListenAddress 443'行嗎?如果是這樣,怎麼樣?也許更重要的是,爲什麼我不能在22端口上連接,如果我沒有觸及或改變任何除了ListenAddress 443之外的sshd_config?

在此先感謝!

編輯:

telnet xx.xx.xxx.xx 22 
Trying xx.xx.xxx.xx... 
telnet: Unable to connect to remote host: Connection refused 

回答

1

您無法連接的三個原因,因爲一個:

  1. sshd在遠程服務器上是下降,因爲它無法解析ListenAddress 443

  2. sshd解析ListenAddress 443成IP地址(「443」可以被解釋爲一個IP地址 - IPv4地址以低水平由一個32位無符號整數表示的),但不能結合所表示的IP地址'443',並下跌。

  3. sshdListenAddress 443解析成一個IP地址,併成功綁定到該IP地址,並且正在運行並監聽「0.0.1.187」上的傳入連接或某個類似IP地址的「443」解釋。

+0

謝謝,安德魯!假設我處於第三種情況......我可以修改本地計算機上的設置,以連接到「443」的任何解釋爲遠程服務器中的IP地址嗎?在我看來,教程是錯誤的,因爲它說我們應該在sshd_config中添加Listen 443來繞過限制。也許他/她打算說端口443. – BringBackCommodore64

+1

可能嗎?你必須欺騙你的地址(http://en.wikipedia.org/wiki/IP_address_spoofing)。您可以源代碼路由(http://en.wikipedia.org/wiki/Source_routing)您的數據包,**和**希望網絡的任何部分都不會丟棄源路由數據包。但是,幾乎可以肯定的是,一些網絡硬件將會丟棄你的源路由數據包。 –

+0

再次感謝,安德魯!我不得不將相關故障卷的故障轉移到調試服務器上,然後修復它,以便以後重新連接。我現在卡在那裏(但那是另一回事)。 – BringBackCommodore64

相關問題