I used Apache Mina sshd-core version 0.10.0.Due to some issues with file uploading i had to change version into 0.14.0.In there i can not override getVirtualUserDir() method. Below is my sample code,
sshd.setFileSystemFactory(new NativeFileSystemFactory() {
@Override
public FileSystemView createFileSystemView(final Session session) {
return new NativeFileSystemView(session.getUsername(), false) {
@Override
public String getVirtualUserDir() {
return "C:/root";
}
};
};
});
I would like to know that how can i overcome that problem in Apache Mina sshd-core version 0.14.0. Thanks.
The purpose of the getVirtualUserDir
in Mina SSHD 0.10.0 was to set an initial directory of the file system.
In Mina SSHD 0.14.0 the same purpose is served by current
parameter of NativeFileSystemView
constructor:
public NativeFileSystemView(String userName, Map<String, String> roots, String current)
Note that the documentation claims not to call the constructor directly and use NativeFileSystemFactory
instead. But the NativeFileSystemFactory
never calls that overload of the constructor. Either the comment is obsolete or the factory is not finished yet.
Or it's a typo and it should have actually referred to VirtualFileSystemFactory
. What is the factory you probably should use instead of overriding NativeFileSystemFactory
.
sshd.setFileSystemFactory(new VirtualFileSystemFactory("C:/root"));