当前位置: 首页 > 工具软件 > Apache SSHD > 使用案例 >

sftp服务器修改密码,SFTP服务器在Apache Mina SSHD中设置用户/密码

龙永思
2023-12-01

public void setupSftpServer(){

SshServer sshd = SshServer.setUpDefaultServer();

sshd.setPort(22);

sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser"));

List> userAuthFactories = new ArrayList>();

userAuthFactories.add(new UserAuthNone.Factory());

sshd.setUserAuthFactories(userAuthFactories);

sshd.setCommandFactory(new ScpCommandFactory());

List> namedFactoryList = new ArrayList>();

namedFactoryList.add(new SftpSubsystem.Factory());

sshd.setSubsystemFactories(namedFactoryList);

try {

sshd.start();

} catch (Exception e) {

e.printStackTrace();

}

}

但我需要为SFTP服务器设置用户登录和pw.我怎样才能做到这一点?谢谢

 类似资料: