Hello Camel_Team, I'm using Apache Camel SFTP consumer in Spring boot application to poll files from a remote directory and create nested directory structures.
When using chmodDirectory in the camel uri for consumption with setgid bit (e.g., 2770 or 2775), Camel only applies the setgid bit to the final endpoint directory, but not to intermediate directories created during the path build process. Expected Behavior: All created directories should have the specified permissions, including the setgid bit. Actual Behavior: - Final directory (/test/tmp) gets full 2770 permissions ✓ - Intermediate directory (/test) gets only 770 (setgid bit ignored) ✗ Camel SFTP URI: consumer-test directory is already created, expecting sftp consumer to create test/tmp sub-directories "//userId@remoteServer:22/consumer-test/test/tmp? password=password& streamDownload=false& readLock=none& delete=false& download=false& disconnect=false& bufferSize=32768& stepwise=false& maximumReconnectAttempts=2& throwExceptionOnConnectFailed=true& backoffErrorThreshold=1& excludeExt=lock& include=.*& maxMessagesPerPoll=10& chmodDirectory=2770" -- We are using Camel 4.18.3 version Logs 2026-09-09 05:28:56,107 TRACE org.apache.camel.component.file.remote.SftpOperations buildDirectoryChunks - Trying to build remote directory by chunk: /consumer-test 2026-09-09 05:28:56,361 TRACE org.apache.camel.component.file.remote.SftpOperations buildDirectoryChunks - Trying to build remote directory by chunk: /consumer-test/test 2026-09-09 05:28:56,616 TRACE org.apache.camel.component.file.remote.SftpOperations buildDirectoryChunks - Trying to build remote directory by chunk: /consumer-test/test/tmp 2026-09-08 05:29:07,361 TRACE org.apache.camel.component.file.remote.SftpOperations chmodOfDirectory - Setting permission: 2770 on directory: /consumer-test/test 2026-09-08 05:29:07,400 TRACE org.apache.camel.component.file.remote.SftpOperations chmodOfDirectory - Setting permission: 2770 on directory: /consumer-test/test/tmp Logs show chmod is *attempted* on both directories, but permissions end up different. ## Actual Permissions drwxrwx--- 770 /consumer-test/test ← Missing setgid! drwxrws--- 2770 /consumer-test/test/tmp ← Has setgid ✓ What I've Tried: 1. ✗ `chmodDirectory=2770` — setgid only applied to final dir 2. ✗ `chmodDirectory=2775` — same issue 3. ✓ `chmodDirectory=775` — works on both dirs (but no setgid) 4. ✗ `stepwise=true` + `chmodDirectory=2770` — same issue Question: How to make this Camel sftp consumer to apply setgid permissions to all subdirectories instead of just the final directory? Please let me know if the provided configuration is valid or any changes are required? Thank you, Samhitha
