2017-07-19 40 views
-1

我剛剛開始了一項工作,我剛剛開始使用ssh,並且正在嘗試創建一個從服務器到我的機器的反向ssh隧道。做反向ssh的錯誤

我開始通過鍵入

ssh -v -f -R port-number1:localhost:port-number2 [email protected] 

這個工作。但是,當我輸入ssh -v -p port-number1 localhost時,會出現此錯誤。

OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for * 
debug1: Connecting to localhost [127.0.0.1] port 52673. 
debug1: Connection established. 
debug1: SELinux support disabled 
Could not create directory '/home/dev/.ssh'. 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/dev/.ssh/id_rsa type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/dev/.ssh/id_rsa-cert type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/dev/.ssh/id_dsa type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/dev/.ssh/id_dsa-cert type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/dev/.ssh/id_ecdsa type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/dev/.ssh/id_ecdsa-cert type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/dev/.ssh/id_ed25519 type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/dev/.ssh/id_ed25519-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 
ssh_exchange_identification: Connection closed by remote host 

現在不知爲什麼,我在服務器上的用戶名是「開發」,這是在根目錄下的一個文件夾,並在主目錄中,有一個名爲Ubuntu的文件夾。當我嘗試在服務器中找到.ssh時,它顯示home/ubuntu/.ssh 這可能是問題所在,但我不知道下一步該怎麼辦,因爲我無法在服務器中移動目錄。

+1

不好意思,但這個Q不是關於StackOverflow定義的編程。它可能**更適合http://superuser.com或另一個StackExchange站點。使用Q底部的'flag'鏈接並請主持人移動它。請不要在2個不同的網站上發佈相同的Q. ***請在發帖之前閱讀http://stackoverflow.com/help/how-to-ask http://stackoverflow.com/help/dont-ask和http://stackoverflow.com/help/mcve更多Qs在這裏。祝你好運。 – shellter

回答

0

運行此遠程主機上:

ssh -N [email protected] -R port:localhost:port 

如果用戶在遠程主機用戶,遠程主機是你想扭轉SSH成箱的IP /域名,端口使用的端口(通常爲22,但如果不是保留端口,則可能是任意的),localhost實際上就是localhost。

然後嘗試SSH到遠程主機。