samhithae created CAMEL-24877:
---------------------------------
Summary: Spring Boot Camel SFTP Consumer: How to apply setgid
permissions to all directories created by SFTP autoCreate?
Key: CAMEL-24877
URL: https://issues.apache.org/jira/browse/CAMEL-24877
Project: Camel
Issue Type: Improvement
Components: camel-ftp, camel-sftp
Reporter: samhithae
Fix For: 4.18.3
We are 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.
h2. Expected Behavior:
All created directories should have the specified permissions, including the
setgid bit.
h2. Actual Behavior:
* Final directory ({{{}/test/tmp{}}}) gets full {{2770}} permissions
* Intermediate directory ({{{}/test{}}}) gets only {{770}} (setgid bit
ignored)
h5. Camel SFTP URI: consumer-test directory is already created, expecting sftp
consumer to create test/tmp sub-directories
{{}}
{code:java}
"//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"{code}
{{}}
*Logs:*
{{}}
{code:java}
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 {code}
{{ }}
Logs show chmod is *attempted* on both directories, but permissions end up
different.{{{}{}}}
{code:java}
{code}
{{## Actual Permissions drwxrwx--- 770 /consumer-test/test ← Missing setgid!
drwxrws--- 2770 /consumer-test/test/tmp ← Has setgid }}
{{{}{}}}What I've Tried:{{{}{}}}
{code:java}
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{code}
{{{}{}}}{{{}{}}}
How to make this Camel sftp consumer to apply setgid permissions to all
subdirectories instead of just the final directory?
Stackoverflow question:
[https://stackoverflow.com/questions/80002202/spring-boot-camel-sftp-consumer-how-to-apply-setgid-permissions-to-all-director|http://example.com/]
Mailing list thread:
[https://lists.apache.org/thread/hh5hj2kdc4k0lvrof40ykqoxjo4kjkor|http://example.com]
{{}}
{{}}
{{}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)