I couldn't reproduce the issue,

I run sftp: docker run -v
/home/claudio/tmp/lixo/random_files:/home/foo/upload -p 2222:22 -d
atmoz/sftp foo:pass

consumer endpoint like this with your parameters
from("sftp:localhost:2222/upload/mysub1/mysub2/mysub3?username=foo&password=pass"

debug log shows:
Auto creating directory: upload/mysub1/mysub2/mysub3

$ ls -lR
.:
total 4
drwxrws---. 3 claudio users 4096 Sep 22 16:33 mysub1

./mysub1:
total 4
drwxrws---. 3 claudio users 4096 Sep 22 16:33 mysub2

./mysub1/mysub2:
total 4
drwxrws---. 2 claudio users 4096 Sep 22 16:36 mysub3

Some research indicates some configuration or bug in the sftp server.

Em ter., 15 de set. de 2026 às 07:03, Samhitha R Eega
<[email protected]> escreveu:
>
> 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



-- 
  Claudio Miranda

[email protected]
http://www.claudius.com.br

Reply via email to