0
votes

I'm trying to upload a file via SFTP using Spring Integration (version 4.1.2). Does anyone know how to configure the sftp:outbound-channel-adapter so that the file gets uploaded automatically to user's home directory without indicating the full directory path in the remote-directory's attribute (ex: remote-directory="/home/sftp_user")?

1
How about just try remote-directory="/"?Artem Bilan
Or ., probably - / might point to the root, unless chroot is in effect.Gary Russell
Thank you both Artem and Gary for your responses. "/" indeed uploads to root. I have not tried "." but an empty string worked for me.vadim

1 Answers

0
votes

The solution is that the remote-directory must be set as an empty string. Please note that the following won't work as it fails the XML model validation:

    <sftp:outbound-channel-adapter
        ...
        remote-directory=""
        ...
    />

I ended up reading the remote-directory from a configuration property which I set as an empty string.