Creating/modifying files via Files.app fails with "SFTP server: Permission denied" despite correct permissions
- Dominant language
- Swift
- Stars
- 6.9k
- Forks
- 746
- PR merge metrics
- No merged PRs in 30d
Description
### Checklist
- [ ] Using latest version on the [App Store](http://itunes.apple.com/app/id1156707581)
- [X] Read the [docs](http://blink.sh/docs/)
- [X] Searched for [existing GitHub issues](https://github.com/blinksh/blink/issues)
### Configuration
Blink v18.1.1.979 (TestFlight), iOS 18.3.2
### Describe the bug
Trying to create a new file or modify an existing file in the Blink file provider fails. The log shows "SFTP server: Permission denied". Modifying or creating the file over SSH in the Blink app works as expected, and creating new folders or deleting files via Files.app also works as expected. Uploading a file via the macOS sftp client works as well.
Edit: In fact, trying to edit an existing file deletes (!!!!!) the file on the remote server. Good thing I have backups.
### Expected behavior
Modifying files in the remote storage via the File Provider works.
### Screenshots

[2025-03-17T03:10:09Z] : [INFO] : createItem Test.txt : Requested with NSFileProviderItemFields: [.contents, .filename, .parentItemIdentifier, .typeAndCreator, .creationDate, .contentModificationDate, .lastUsedDate] and NSFileProviderCreateItemOptions: []
[2025-03-17T03:10:09Z] : [INFO] : createItem Test.txt : Is a File
[2025-03-17T03:10:09Z] : [INFO] : createItem Test.txt : Creating file saiko/Test.txt...
[2025-03-17T03:10:09Z] : [DEBUG] : createItem Test.txt : Ensure can create file at saiko with Test.txt
[2025-03-17T03:10:09Z] : [DEBUG] : createItem Test.txt : No file. Can create.
[2025-03-17T03:10:09Z] : [DEBUG] : createItem Test.txt : Copy file .blink.tmp.67318699...
[2025-03-17T03:10:09Z] : [ERROR] : createItem Test.txt : Creating file error: Fail(msg: "SFTP server: Permission denied")
[2025-03-17T03:10:10Z] : [INFO] : WorkingSet : Timer triggered
[2025-03-17T03:10:10Z] : [INFO] : WorkingSet : Preparing changes. 0 items in commit.
[2025-03-17T03:10:10Z] : [INFO] : WorkingSet : No changes.
[2025-03-17T03:10:14Z] : [DEBUG] : WorkingSet : Deinit
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure from Files.app using the reported Blink and iOS versions, then trace the File Provider `createItem` path indicated by the log, including the temporary-file copy operation. Done means creating and editing remote files succeeds without permission errors or deleting the original, while folder creation, deletion, and SSH behavior remain intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100