Subject: sftp_mkdir() with server default permissions

sftp_mkdir() with server default permissions

From: Will Cosgrove <>
Date: Tue, 6 Nov 2018 09:56:11 -0800

Hi All,
I’d like to modify sftp_mkdir() so it will optionally not use a mode for the new directory. This allows the server to create the folder with the default permissions value which some users require. Unfortunately the sftp_mkdir() function requires a mode. So I’m curious to know how you think I should proceed?

There are several possible solutions, my current super simple solution is to pass -1 as the mode which then causes sftp_mkdir to not set the permissions on the folder. That works, but it’s a bit ‘magical’ if you’re not reading the source. Another other option is to create a new API that doesn’t take a mode, but that also has its draw-backs. Any thoughts on how you all would like to see this structured?


Received on 2018-11-06