1

I have the /test directory by this path on the SFTP server - /out/test (root directory -> /test). I set this path in the SFTP URL for my application - sftp://username@host.com:22/out/test?fileName=file.txt, but it throws an exception:

Cannot change directory to: test

I know that my directory is a subfolder for the root directory, but looks like Apache Camel ignores this path in the URL (DSL in my code) and go to the /home/{username} and as result can't find this folder in /home, because it doesn't exist here. Maybe I didn't specify the URL correctly (maybe I should do something like this //)?

I tried this solution, but it didn't help:

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Andrei Kulik
  • 446
  • 1
  • 5
  • 21

1 Answers1

1

What version of Camel do you use?

There is no support for absolute paths (as its security problem and also dont work on all FTP servers) in newer Camel versions. You can on the FTP server have symlinks or whatnot to make the user jump to any folder you like (configure user accessibility on the FTP sever).

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65
  • Hello, Claus! Sorry, but I don't have access to a computer, right now. I'll answer you tomorrow. Thx for your help! – Andrei Kulik Jul 05 '21 at 19:08
  • Hello, Claus! I see that I use the 3.9.0 version for all my Camel dependencies (including for the camel-ftp). Thank you very much for the advice to use symlinks but I have a question about it. Where is should symlink locate? I mean, if Camel doesn't support absolute paths, what directory does it go to when connecting? When I manually connect on the SFTP server by these credentials (in FileZilla for example), then I get in the root `/`, but I need to go in the `/out/test` dir. Should I put a symlink for the `/out/test` dir in the `/`? Should my URL include a path to the `/out/test` symlink? – Andrei Kulik Jul 06 '21 at 09:03