spring integration sftp mainframe :failed to write file; nested exception is 3: Permission denied

*爱你&永不变心* 提交于 2019-12-02 01:31:16

Why am I getting “Permission denied at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2297)”

We received this error because on some sftp servers “/” meant the root of the user’s home directory, but on others it literally meant the server root to which the user obviously did not have permissions to write. We also received this on some sftp servers when the directory to which the user was trying to write didn’t exist.

Another quete:

I was having the problem also with SFTP and figured out that in the parameters for the File Writer FTP in the box to the right of the ftp server name or address you have to put the fully qualified path of the folder you are going to put files in. Otherwise the MIRTH SFTP tries to change directory to / and gets a permission denied. eg. sftp:// 111.222.333.444 / foldera/folderb/folderc/

To find out what foldera/folderb/folderc/ should be use some sort of SFTP client that works (not MIRTH) and when it connects you it should show the path of folders that you are in.

This worked for me.

So, your issue that your SFTP path starts with /. The code from ChannelSftp.put:

dst=remoteAbsolutePath(dst);
...
private String remoteAbsolutePath(String path) throws SftpException{
   if(path.charAt(0)=='/') return path;
   String cwd=getCwd();
   if(cwd.endsWith("/")) return cwd+path;
   return cwd+"/"+path;
}

Try to figure out how to avoid / in the beginning.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!