通过身份验证的ssh登录正常。
C:\Users\${DEVELOPER_NAME}>ssh ${HOST_IP_ADDRESS} -l ${DEVELOPER_NAME} -p ${SSHD_PORT} -i D:\prefix\PuTTY\${OPENSSH_FORMAT_PRIVATE_KEY}
Last login: Sun May 5 15:27:50 2019 from 10.40.171.44
Welcome to ...
[${DEVELOPER_NAME}@${HOST_AKA} ~]$
但是sshd运行在36000而不是默认的22端口上,我该如何告诉vs代码remote-ssh插件
Host ${DEVELOPER_NAME}@${HOST_IP_ADDRESS}
HostName ${HOST_IP_ADDRESS}:${SSHD_PORT}
User ${DEVELOPER_NAME}
Port ${SSHD_PORT}
IdentityFile D:\prefix\PuTTY\${OPENSSH_FORMAT_PRIVATE_KEY}
这种方式给了我
Can't connect to ${DEVELOPER_NAME}@${HOST_IP_ADDRESS}: unreachable or not Linux x86_64 (ssh: connect to host ${HOST_IP_ADDRESS} port 22: Connection refused)
和
${DEVELOPER_NAME}@${HOST_IP_ADDRESS}:${SSHD_PORT}
在Remote-SSH: Connect to Host...
中的给了我
Can't connect to ${DEVELOPER_NAME}@${HOST_IP_ADDRESS}:${SSHD_PORT}: unreachable or not Linux x86_64 (ssh: Could not resolve hostname ${HOST_IP_ADDRESS}:${SSHD_PORT}: Name or service not known)
答案 0 :(得分:0)
感谢您的问题,我解决了。您可能已经想清楚了...您无需为HostName添加端口。只需编写端口即可。
Host ${HOST_NICKNAME}
User ${USER_ID_HOST}
HostName ${HOST_IP_ADDRESS}
Port ${SSHD_PORT}
IdentityFile ~/.ssh/id_rsa-remote-ssh