反向 SSH 和 SSH 金鑰

反向 SSH 和 SSH 金鑰

設想

VPS 在互聯網上。公司網路後面的內部機器。

目標

$internal_machine連接到$VPS;我登入$VPS並連接到$internal_machineSSH 會話將位於本地$VPS

按鍵

$VPS包含 .authorized_hosts 中的公共 SSH 區塊。$internal_machine正在與私鑰連接$VPS

程式碼

$internal_machine

ssh -oStrictHostKeyChecking=accept-new -i .ssh/KEY -R 2048:localhost:22 vps.internet.net

連線已建立。提示輸入$internal_machine更改為$VPS迅速的。

在 $VPS 上:

ssh -p 2048 localhost

錯誤:

ubuntu@localhost: Permission denied (publickey).

我也嘗試過連接,在$VPS,用 -i 指定鍵也不起作用。

我是否誤解了這是如何運作的?

答案1

需要使用的金鑰是最初配置用於登入 $VPS 的金鑰。

相關內容