Empty Files Created by sftp
Chris Rapier
rapier at psc.edu
Wed Jul 1 12:15:06 AEST 2026
Oh, I'm sure the correct solution is to just use -R but this just seemed
weird to me. If it's expected behaviour that's fine.
On 6/30/2026 22:06, Chris Rapier wrote:
> I seem to have a found an odd situation. When the sftp-server is
> instantiated with "-P write" and I try putting a file I get the expected
> permission denied error.
>
> sftp> put xxhash.h
> Uploading xxhash.h to /tmp/xxhash.h
> xxhash.h 98% 255KB 238.9MB/s 00:00 ETA
> write remote "/tmp/xxhash.h": Permission denied
>
> However, I still get a file created at the destination with a file size
> of 0.
>
> rapier@:/tmp$ ls -l xxhash.h
> -rw-rw-r-- 1 rapier rapier 0 Jun 30 21:28 xxhash.h
>
> So it seems the file was opened but the write was disallowed. The main
> issue being that it consumes inodes and just generally clutters things
> up. This can be a real issue on large puts. I haven't tried this against
> 10.4 so you might have already resolved this.
>
> I'm pretty sure the issue is that the -P write will prevent the writes
> but it doesn't match on the open. If you do -P write,open then you can't
> actually do any reads. I'm digging into a fix but I don't like what I
> have at the moment. I don't think this would be a common scenario but it
> came up recently and thought I should bring it up.
>
> Chris
More information about the openssh-unix-dev
mailing list