No announcement yet.

SFTP file upload - how is it determined what Unix permissions to apply to files?

  • Filter
  • Time
  • Show
Clear All
new posts

  • SFTP file upload - how is it determined what Unix permissions to apply to files?

    I love Beyond Compare - I've been using it for about 14 years - it's like my Swiss Army Knife. Thanks for such a great tool.

    I have a problem kind of outside of Beyond Compare, but I think it could help to clarify some BC behaviour...

    I am a developer, working on Windows, using Netbeans as my IDE. I have Netbeans configured to upload files on save to a remote (Linux) server. Netbeans uses SFTP for this. I'm having a problem where the files uploaded to Linux are not group-writable. I did some research and apparently I need to add a umask to the sshd_config file on the Linux server, to specify the default permissions of files uploaded via SFTP. However, when I made this change, it didn't work - uploaded files still have -rw-r--r-- permissions.

    So, where does Beyond Compare come into it? Well, if I use Beyond Compare to upload files from my Windows computer to the Linux server (which also go via SFTP), the files get created with the correct permissions: -rw-rw-r-- And it seems that this is the case whether or not I have that umask setting in the sshd_config file. (Yes I restarted sshd on the Linux server after each change to the config file.)
    How is this happening? I'd really appreciate if someone could shed a bit more light on this for me.


    Edit: Maybe I spoke too soon. I tried again with BC, uploading files via SFTP, but this time to a different Linux server, and they arrive with -rw-r--r-- permissions. So, not group-writable.
    I think I should run through my test again, making sure I don't make any mistakes editing the sshd_config file and restarting sshd. I guess it's also possible that Netbeans is doing something funky regardless.
    Last edited by osullic; 20-Jul-2020, 07:06 PM.

  • #2

    I chatted with a developer for expected behavior, and BC would attempt to copy the unix permissions if performing an SFTP from Unix to Unix, but Windows to Unix should default to whatever the server decides for that client transfer.

    As a general troubleshooting recommendation, from someone that has had to set up test scenarios before, if you can: restart the processes after any configuration change. Usually you can kill the server process and start it up again, but in extreme cases you can always issue a quick system reboot. Occasionally, I'll inject a very controllable/verifiable change (such as a different username or password, altered home directory, or permissions) just to make sure the server is pulling in the most recent configuration changes and not caching anything unexpected.
    Aaron P Scooter Software