Thursday, December 4, 2014

SSH vfs2 Change FTP Directory

Following configuration can be used to change logged user directory. In normally, FTP directory is set to logging user home. Sometimes, you have to access directories outside of the logging SFTP user home.

SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, false);

This code snip can be used, when you are using vfs2 SFTP client.

Now, you can FTP files in any location using following SFTP URI.

"sftp://" + userID + ":" + password + "@" + sftpHost + "/" + remoteDirectory + fileName

Change remote directory as you preferred.

No comments:

Post a Comment