Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve file permissions broken #142

Open
MartinX3 opened this issue Dec 21, 2021 · 6 comments
Open

Preserve file permissions broken #142

MartinX3 opened this issue Dec 21, 2021 · 6 comments

Comments

@MartinX3
Copy link

Regardless if I enable or disable the setting, gftp always changes the file permissions.
If I send the file from my local computer to the webspace, the file in the webspace now has the same permissions like on my local computer.
This breaks the website, since of course on my local computer only the owner and the group can read the file but on the webspace everyone needs to read the file as a visitor.

@wdlkmpx
Copy link
Collaborator

wdlkmpx commented Dec 22, 2021

I need to perform some tests to see how the file permission stuff works

But I think the preserve_permissions option must be removed

I have a file that has the following permissions

-rwxr-xr-x vivaldi-stable_3.8.2259.42-1_i386.deb

But vsftpd reports (using LIST command):

-rw-r--r-- vivaldi-stable_3.8.2259.42-1_i386.deb

As you can see, (some) FTP servers report wrong permissions

Perhaps FTP servers don't report the true file permissions but the permissions granted to the FTP client (this always seem to be the case with MLSD)

MLSD: permission handling is completely broken, and servers may report permissions that don't map to UNIX permissions, so overall the feature can be considered broken and must be removed.

But I'm not sure that will fix the issue you're seeing, I'll perform tests to get a better picture of the situation ...

@MartinX3
Copy link
Author

Thank you for your response.

In my case the permissions on my site and the server site are correct if I look in my terminal / in SSH.
In my case gftp just overrides the server file permission with my local permission each time.
But I can correct it with the "edit permission" dialogue of gftp or via SSH.

@wdlkmpx
Copy link
Collaborator

wdlkmpx commented Dec 23, 2021

Well it shouldn't override default file permissions if the preserve_permissions setting is disabled

It works as expected with the FTP protocol, I just verified that vsFTPd reports the real permissions, I was looking in a different directory. If using MLSD, some servers will report stuff that doesn't map to unix permissions, so it's "partially" broken when it comes to applying permissions after downloading files, depends on the server.

Now I have to see how it works with SFTP, it's probably specifying file permissions when uploading a file or something, and the preserve_permissions setting doesn't change the behavior, I'm speculating
https://serverfault.com/questions/283492/how-to-specify-file-permission-when-putting-a-file-using-openssh-sftp-command
I have to test

@MartinX3
Copy link
Author

Oh, yes, I use SSH FTP (SFTP)

@wdlkmpx
Copy link
Collaborator

wdlkmpx commented Feb 2, 2022

Sorry for the long delay. I've been unable to set up a local SSH server, but I did upload a few files to source forge, files with unsuitable permissions and those permissions were not preserved, so SF is setting its default permissions

It's easy for to you determine if gFTP is actually the culprit, upload files with permissions 600, 644, 755, 777 and so on, if all those permissions are preserved then it may be gftp, otherwise the server is applying some defaults

And the log reveals info, when gftp preserves permissions, you'll see that in the log, it explicitly tells you whether it succeeded changing permissions after uploading files, copying and pasting some lines would not be a bad idea

@MartinX3
Copy link
Author

MartinX3 commented Feb 2, 2022

Ah, preserve permission sets the permissions of my local computer file on the ftp storage.

And the other permissions seems to be the server default.
Thank you for your help.

In the first place I thought preserving the permissions means that it won't change the file permission of the file on the server, if gFTP overrides an existing file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants