How to specify file permission when putting a file using OpenSSH sftp command
Posted
by
Adi Roiban
on Server Fault
See other posts from Server Fault
or by Adi Roiban
Published on 2011-06-23T16:45:24Z
Indexed on
2012/06/25
3:18 UTC
Read the original article
Hit count: 544
I am using various SFTP clients for uploading files to an SFTP server and I have a problem with default permission used when putting files.
When requesting to put a file, SFTP client like WinSCP or Filezilla will send the SSH_OPEN command without requesting any explicit file permission.
On the other side, it looks like the OpenSSH sftp command on Linux (Red Hat and Ubuntu) is pending the SSH_OPEN command together with the '640' mode.
How can I configure the OpenSSH command to not explictly set the file mode or how can I configure it to send a mode, other than 640?
Many thanks!
Update:
I checked the OpenSSH sftp client source code and it looks like OpenSSH sftp will always tries to preserve file mode even if -P is not set: http://www.koders.com/c/fidD3B20680F615B33ACCB42398FAAFEE1C007DF942.aspx?s=rsa#L986
To solve this problem I used Putty SFTP client.
© Server Fault or respective owner