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

使用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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值