VScode Remote SSH插件用密鑰登錄

remote SSH在第一次啓動時會讓用戶選擇配置文件的存儲位置,這裏我選擇了默認位置:C:\Uses\yourUsername\.ssh\config
當我們想使用SSH私鑰登錄服務器時,只需在上述文件裏添加一條:IdentityFile /path/to/yourPrivateKey
而該私鑰可自己生成或複用其他工具生成的,最後config文件內容如下:

Host name-of-ssh-host-here
    User your-user-name-on-host
    HostName host-fqdn-or-ip-goes-here
    IdentityFile ~/.ssh/id_rsa-remote-ssh

關聯官方文檔:
https://code.visualstudio.com/docs/remote/troubleshooting#_configuring-key-based-authentication

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章