Loading

How to write files to the root ("/") directory when using the SFTP outbound endpoint

Publiceringsdatum: Jul 18, 2025
Lösning

GOAL

Sometimes it is necessary to write files to the root ("/") directory of an SFTP server. This usually requires a specific setup by the SFTP server administrator since Linux/UNIX systems by default disable write permission on the / directory for non-root users).

PROCEDURE

In order to write to the root ("/") directory, please configure the "path" attribute of the <sftp:outbound-endpoint> as following: path="//" (notice the double "/" character).

For example:

<sftp:outbound-endpoint exchange-pattern="one-way" outputPattern="the_file.txt" host="thesftpserver.com" port="22" path="//" user="theuser" password="thepassword" responseTimeout="10000" doc:name="SFTP" />

Specifying the path just as path="/" (a single "/" character) will cause an exception like the following:

org.mule.transport.sftp.SftpClient: Error '' occurred when trying to CDW to ''.
org.mule.transport.sftp.SftpMessageDispatcher: Unexpected exception attempting to write file, message was: Error '' occurred when trying to CDW to ''.
java.io.IOException: Error '' occurred when trying to CDW to ''.
	at org.mule.transport.sftp.SftpClient.changeWorkingDirectory(SftpClient.java:121) ~[mule-transport-sftp-3.9.0.jar:3.9.0]
	at org.mule.transport.sftp.SftpConnector.createSftpClient(SftpConnector.java:206) ~[mule-transport-sftp-3.9.0.jar:3.9.0]
	at org.mule.transport.sftp.SftpMessageDispatcher.doDispatch(SftpMessageDispatcher.java:81) ~[mule-transport-sftp-3.9.0.jar:3.9.0
Knowledge-artikelnummer

001118341

 
Laddar
Salesforce Help | Article