Remote-ftp: Default file permissions

Created on 13 Nov 2016  路  22Comments  路  Source: icetee/remote-ftp

After a recent update, it seems the new files uploaded by remote ftp were defaulting to permissions 666 instead of 644. Not sure if caused by remote ftp. Is this an intentional change? Is there a way to reverse this?

testing

Most helpful comment

I'm having this issue as well. If I open a file with Remote-FTP and then save it back to the server, it always has rw-rw-rw as the permissions, even though it may have ben rwxrwxr-x previously.

Can we fix this plugin so that it retains the permissions as they were when it opened the file, instead of changing them? I have to manually change the permissions on every file before I commit. This is troublesome.

All 22 comments

Same issue here. Every time I save a file the permissions of the file gets changed for some reason...

Just installed remote-ftp for the first time tonight in Atom, uploaded a file, and file permissions were as described above. Please provide an update. Thanks!

Yes, I have the same problem as the others. I even tried going through the whole remote-ftp directory and replaced all instances of "666" with "644" and looked for suspicious spots with chmod, lol, and it didn't do anything. Surprisingly, my changed didn't even break the plug-in, ;P

Unfortunately for otherwise such a great plug-in, it's a dealbreaker for me :'(

There shouldn't have been any amends in remote ftp which would effect the file permissions. So I'm not too sure what to suggest here.

Not to whine, but Is there a way I can rollback to the last version? having to login into the remote box and chmod every file you edited is just not working.

i was able to reproduce this from an Atom instance on a Win 7 machine to a CentOS remote box, and from a Mac with a totally different instance of Atom to a different CentOS box and both times the file saves with 666 perms. I was able to confirm this was not happening in the later test until after the update.

I just did another round of tests and all my files came out as 644. Still not sure what is causing the issue or what resolved it.

@dnunn1 Sure follow the steps below. This assumes that you have access to npm and apm in the cmd / terminal

  • Uninstall Remote Ftp
  • Download the version you want. Releases
  • Unpack somewhere ( can be anywhere )
  • Go to that directory in cmd / terminal
  • type apm link and hit enter
  • type npm install and hit enter

Been able to rollback to other versions, but then the remote tree view sees everything as a directory and you can't open any remote files.

I've tried to scratch load Atom after removing it completely, including the pref files, and install only Remote-FTP with no luck. So now the latest version is the only one that sees the files, as files, weird.

Just curious, when was atom itself last updated? Could it be possible that the resides on how atom is saving files and nothing to do with remote-ftp?

*that the problem resides

I thought of this as well. This seems to be the update schedule:

https://atom.io/releases

Not sure if any of these might be it, unless perhaps this one resolves it:

https://github.com/atom/atom/issues/13104

I'm having this issue as well. If I open a file with Remote-FTP and then save it back to the server, it always has rw-rw-rw as the permissions, even though it may have ben rwxrwxr-x previously.

Can we fix this plugin so that it retains the permissions as they were when it opened the file, instead of changing them? I have to manually change the permissions on every file before I commit. This is troublesome.

I have used atom and this package for quite some times now but I have to let it go for a while I suppose. I truly don't understand. I have uninstall atom and this package like a 100 times, went through the package's code to see if I could find any problems but I can't. We are a team of devs working together at the moment all using atom and we all are scratching our heads to find a solution but no luck for a week.

Are you guys using ftp or sftp?

@jimmaaay I'm using SFTP

@jimmaaay SFTP

Looking through the documentation for ssh2 it seems as though the permissions have always defaulted to 666. However I have added something in the dev branch to allow you to change the permissions of uploaded files. I need to do some testing but if anyone would like to use it in the dev branch add the option "filePermissions":"0644" to the config.

Also note that it only works if you upload the file, not if you right click and select add new file in the remote view.

If I am using remote-ftp to edit a file which lives on a remote server, my expectation is that when it saves any changes that I make to the file, the file would be saved with exactly the same permissions as it had initially.

I edit an executable python file and it changes it to 666, removing the executable bit. I edit a private file and it changes the permission to 666, exposing it. This makes no sense to me that this would be the intended behavior of a remote ftp plugin for a text editor.

@lukwam I know it's not the best solution. But at this time I am currently the only person maintaining the project and I don't have too much time to spend on it currently. The solution which you have proposed would take me considerably longer to implement.

my temporary solution I use the second one
1.change default permission
.atom/packages/Remote-FTP/lib/connectors/sftp.js

304 : var writeStream = self.sftp.createWriteStream( remotePath );
to
304 : var writeStream = self.sftp.createWriteStream( remotePath,{"mode":420});
// 420== 0644, 436 == 0664

  1. or don't change any permission
    .atom/packages/Remote-FTP/node_modules/ssh2-streams/lib/sftp.js
    1856 : SFTPStream.prototype.fchmod = function(handle, mode, cb) {
    1857 : // return this.fsetstat(handle, {
    1858 : // mode: mode
    1859 : // }, cb);
    1860 : };

Happening for me as well, switching to FTP seems to work for now.

See #611

Was this page helpful?
0 / 5 - 0 ratings