suntobright / vscode-sftp

Edit remote Linux files directly in VS Code.
MIT License
14 stars 6 forks source link

Preserve or set file permission #10

Open ricardo85x opened 5 years ago

ricardo85x commented 5 years ago

hi thanks for this amazing extension.

I would like to know if is it possible to set the file permission when you make a change on a remote file.

today it is look like it is setting rw-rw-rw when I save the file.

I have some script on a linux server and it should be rwx.

ricardo85x commented 4 years ago

It is look like it is not possible to keep the mode

https://github.com/mscdex/ssh2-streams/issues/128

Maybe we can provide a config where we can set the mode manually when we create a connection

on FsProvider.js I did change the following to keep the mode 777:

Remove:

const remote: Writable = conn.sftp.createWriteStream(uri.path, { flags: openFlags });

Add:

var mode = parseInt('0666',8) // default mode from ssh2-streams

const listExecutableExt = ['.PY', '.SH']; // executable files

listExecutableExt.forEach(function(ext) {
     if (String(uri.path).toUpperCase().endsWith(ext)) {
        mode = parseInt('0777',8)
    }
})

const remote: Writable =  conn.sftp.createWriteStream(uri.path, { flags: openFlags,  mode });
DangerD1024 commented 4 years ago

Maybe we can provide a config where we can set the mode manually when we create a connection

Need to add, because after changing to 666 i get internal server error...

SamarthaKV29 commented 3 years ago

THIS NEEDS TO BE FIXED ASAP

DangerD1024 commented 4 months ago

Any update with that? 3 Years of pain))