使用VScode查看远程服务器代码

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

目录

  • 使用VScode查看远程服务器代码
    • 安装VSCode以及配置ssh
    • 解决Bad owner or permissions

使用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

你可能感兴趣的:(工具)