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).
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
001118341

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.