apache-sshd

How to upload/download files using apache SSHD ScpClient

女生的网名这么多〃 提交于 2021-02-16 20:21:47
问题 I don't know what I doing wrong in setting up a ScpClient to send/receive files. I am using Apache MINA SSHD library to start a SSH server and try to copy files to/from it. Here is my setup: SSHServer.java public class SSHServer { private SshServer sshServer; private static final Logger logger = LoggerFactory.getLogger(SSHServer.class); public SSHServer() { sshServer = SshServer.setUpDefaultServer(); sshServer.setHost("127.0.0.1"); sshServer.setPort(22); sshServer.setKeyPairProvider(new

How to block SFTP remove operations with Apache MINA SSHD

南笙酒味 提交于 2020-01-23 03:08:09
问题 I am trying to create a custom sftp server using Apache Mina SSHD. My code so far: SshServer sshd = SshServer.setUpDefaultServer(); sshd.setPort(PORT_NUMBER); sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(Paths.get("keys/private_key.ppk"))); SftpSubsystemFactory factory = new SftpSubsystemFactory.Builder() .build(); factory.addSftpEventListener(new BasicSftpEventListener()); sshd.setSubsystemFactories(Collections.singletonList(factory)); sshd.setShellFactory(new