How to Set Root Directory in Apache Mina Sshd Server in Java

前端 未结 3 1174
醉梦人生
醉梦人生 2020-12-15 22:20

I use Apache Mina Sshd API to start up a local SFTP server in java.In SFTP client i use Jcraft jsch API to create my SFTP client.I successf

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-15 22:51

    In more recent sshd versions you can use org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory and supply it to the SshServer instance via method setFileSystemFactory.

    Snippet:

    VirtualFileSystemFactory fileSystemFactory = new VirtualFileSystemFactory();
    fileSystemFactory.setDefaultHomeDir("home.directory");
    sshd.setFileSystemFactory(fileSystemFactory)
    

提交回复
热议问题