使用VScode查看遠程服務器代碼

原文鏈接:https://blog.starunity.dev/2019/05/08/remote-ssh-configure/

使用VScode查看遠程服務器代碼

安裝VSCode以及配置ssh

參考《Remote-SSH配置–如何配置VSCode遠程開發》https://blog.starunity.dev/2019/05/08/remote-ssh-configure/

解決Bad owner or permissions

Bad owner or permissions 即對某個文件沒有訪問權限,不同系統的解決方式不同。

  • window10系統
  • 官方解決方案: https://code.visualstudio.com/docs/remote/troubleshooting#_local-ssh-file-and-folder-permissions
    如下:

Windows: The specific expected permissions can vary depending on the
exact SSH implementation you are using. We strongly recommend using
the out of box Windows 10 OpenSSH Client. If you are using this
official client, cut-and-paste the following in an administrator
PowerShell window to try to repair your permissions:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

Install-Module -Force OpenSSHUtils -Scope AllUsers

Repair-UserSshConfigPermission ~/.ssh/config
Get-ChildItem ~\.ssh\* -Include "id_rsa","id_dsa" -ErrorAction SilentlyContinue | % {
    Repair-UserKeyPermission -FilePath $_.FullName @psBoundParameters
}

For all other clients, consult your client’s documentation for
what the implementation expects. However, note that not all SSH
clients may work.

  • 官方解決方案的問題
    Install-Module -Force OpenSSHUtils -Scope AllUsers執行時報錯
  • 本人的解決方案:卸載openSSH
    管理員模式下打開PowerShell, 運行下面命令卸載OpenSSH
# Uninstall the OpenSSH Client
Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

# Uninstall the OpenSSH Server
Remove-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章