vscode SFTP Natizyskunk 权限被拒绝,无法修改和上传文件

vscode SFTP Natizyskunk permission denied, cannot modify the files and upload them

我在 vscode 中使用这个扩展来修改我服务器上的文件:SFTP Natizyskunk

但我不能。

这是错误:

permission denied

这是日志:

[12-10 22:53:06] [error] Error: Permission denied
    at 101 (c:\Users\Mask\.vscode\extensions\natizyskunk.sftp-1.15.10\node_modules\ssh2\lib\protocol\SFTP.js:2618:19)
    at SFTP.push (c:\Users\Mask\.vscode\extensions\natizyskunk.sftp-1.15.10\node_modules\ssh2\lib\protocol\SFTP.js:278:11)
    at CHANNEL_DATA (c:\Users\Mask\.vscode\extensions\natizyskunk.sftp-1.15.10\node_modules\ssh2\lib\client.js:525:23)
    at 94 (c:\Users\Mask\.vscode\extensions\natizyskunk.sftp-1.15.10\node_modules\ssh2\lib\protocol\handlers.misc.js:859:16)
    at Protocol.onPayload (c:\Users\Mask\.vscode\extensions\natizyskunk.sftp-1.15.10\node_modules\ssh2\lib\protocol\Protocol.js:2025:10)
    at AESGCMDecipherNative.decrypt (c:\Users\Mask\.vscode\extensions\natizyskunk.sftp-1.15.10\node_modules\ssh2\lib\protocol\crypto.js:987:26)
    at Protocol.parsePacket [as _parse] (c:\Users\Mask\.vscode\extensions\natizyskunk.sftp-1.15.10\node_modules\ssh2\lib\protocol\Protocol.js:1994:25)
    at Protocol.parse (c:\Users\Mask\.vscode\extensions\natizyskunk.sftp-1.15.10\node_modules\ssh2\lib\protocol\Protocol.js:293:16)
    at Socket.<anonymous> (c:\Users\Mask\.vscode\extensions\natizyskunk.sftp-1.15.10\node_modules\ssh2\lib\client.js:713:21)
    at Socket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23) when local ➞ remote c:\laragon\www\my-shopify-app\server.php

这是我在 vscode:

中的 sftp 配置
{
    "name": "My Server",
    "host": "51.80.151.9",
    "password": "*************",
    "protocol": "sftp",
    "port": 22,
    "username": "Mask",
    "remotePath": "/home/mask.mywebsite.net",
    "uploadOnSave": true,
    "useTempFile": false,
    "openSsh": true,
    "ignore":[
        ".vscode",
        ".git",
        ".DS_Store",
        ".env"
    ]
}

我在我的服务器上使用 ubuntu server

我觉得很容易修复

您只是没有权限使用当前用户修改您服务器上的文件。

将用户添加为目录所有者:

sudo chown -R yourUsername:root yourPathDirectory

-R表示递归

之后,您的用户可以修改该目录中的文件,您的权限将不会被拒绝。