Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Set permissions in Upload options

martin wrote:

[list][*]It won't work for SCP at all, because when uploading file WinSCP cannot know if the file was already there before (because SCP is stupid protocol :-(), nor who is an owner of the file. It can guess it from the directory cache, but that's not reliable enough, so I would not dare to go this way.

Another cons with SCP protocol is that with it the client must tell in advance whether is wants the server to set permissions or not for the whole transfer (all selected files and directories).
martin

Re: Set permissions in Upload options

Manta wrote:

I propose a new checkbox near "Add X to directories". I'm not sure which is better, but I'd suggest either "Only on files owned by me" or "New files only".

This way if Dude A creates a file, it's owned by him and WinSCP sets it write-by-group. Then Dude B logs in and modifies the same file, WinSCP doesn't try to set mode on the file (which would fail).

That's good idea. But unfortunately it has some cons:
  • There's not enough place for the checkbox on the dialogs (the biggest problem :-))
  • It won't work for SCP at all, because when uploading file WinSCP cannot know if the file was already there before (because SCP is stupid protocol :-(), nor who is an owner of the file. It can guess it from the directory cache, but that's not reliable enough, so I would not dare to go this way.
  • With SFTP, WinSCP can know if the file is there easily, but it won't know who is an owner of the file. WinSCP can ask in advance, but that would slow down the upload, because of another dialog with the server. But OK, it is optional, why not.
Alternatively, which I only just figured out now, why not completely disable set mode or set time for any transfer if the file exists and the file owner doesn't match the logged in username? In my understanding of Unix permissions, you are never able to set mode unless you own the file. Possibly an easier solution?

OK, but with WinSCP you can connect not only to Unix servers.
Manta

Set permissions in Upload options

Martin

Love your work. Seriously. Fantastic to have WinSCP for free.

I'm impressed to keep finding little options that perfectly solve my problem. Most recently I found "Daylight saving time" in the "Environment" section of Session options. Gold. Daylight saving is the bane of my life, and now it's all fixed simply with "Server works in UTC time". Now all the servers I've built using "RTC uses UTC" all work together nicely with WinSCP sychronisation.

I'm recently having problems with one of my development servers. We have several developers all working on the same files at different times, so I have put all users into primary group "users" and set Samba to add g+w and g+wx to everything. I've even set Apache with primary group "users" so we can all play together and no-one complains.

Light shone from the heavens when I found "Upload options" in the "Transfer" section in Preferences. "Add X to directories" is a fantastically smart thing to add, very happy with that. I saw someone else's post here commenting on how perfect that all is.

One minor issue though is that this pretty much only works when the logged-in user is the user who created the file in the first place (i.e. only works on files owned by the logged in user). Even amongst users in the same primary group, where all files and directories are g+w, we get these "set mode: operation failed" errors.

Now I know this is not your fault, as these are the rules of "chmod", not WinSCP, but there is a solution that might be relatively easy for you to implement.

I propose a new checkbox near "Add X to directories". I'm not sure which is better, but I'd suggest either "Only on files owned by me" or "New files only".

This way if Dude A creates a file, it's owned by him and WinSCP sets it write-by-group. Then Dude B logs in and modifies the same file, WinSCP doesn't try to set mode on the file (which would fail).

Alternatively, which I only just figured out now, why not completely disable set mode or set time for any transfer if the file exists and the file owner doesn't match the logged in username? In my understanding of Unix permissions, you are never able to set mode unless you own the file. Possibly an easier solution?

Either way, if you were able to fix this, it would leave no holes in my little empire here, where people could put new files in place with Samba, Apache could put things down into the filesystem (and immediately chmod them g+w), WinSCP would join in and we could all still play together.

Hope this all makes sense, and I hope it's a simple enough thing for you to add in.

Thanks again, WinSCP is a fantastic piece of software.

Manta