Java SFTP server library? [closed]

How to setup an SFTP server using Apache Mina SSHD: public void setupSftpServer(){ SshServer sshd = SshServer.setUpDefaultServer(); sshd.setPort(22); sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(“hostkey.ser”)); List<NamedFactory<UserAuth>> userAuthFactories = new ArrayList<NamedFactory<UserAuth>>(); userAuthFactories.add(new UserAuthNone.Factory()); sshd.setUserAuthFactories(userAuthFactories); sshd.setCommandFactory(new ScpCommandFactory()); List<NamedFactory<Command>> namedFactoryList = new ArrayList<NamedFactory<Command>>(); namedFactoryList.add(new SftpSubsystem.Factory()); sshd.setSubsystemFactories(namedFactoryList); try { sshd.start(); } catch (Exception e) { e.printStackTrace(); } } And that’s all.

How to download only the latest file from SFTP server with Paramiko?

Use the SFTPClient.listdir_attr instead of the SFTPClient.listdir to get listing with attributes (including the file timestamp). Then, find a file entry with the greatest .st_mtime attribute. The code would be like: latest = 0 latestfile = None for fileattr in sftp.listdir_attr(): if fileattr.filename.startswith(‘Temat’) and fileattr.st_mtime > latest: latest = fileattr.st_mtime latestfile = fileattr.filename if latestfile … Read more

Password authentication in Python Paramiko fails, but same credentials work in SSH/SFTP client

Your server is using a keyboard-interactive authentication, not a simple password authentication. Normally Paramiko is smart enough to fallback to the keyboard-interactive authentication, when the password authentication fails and the keyboard-interactive prompt has one field only (likely a password). The problem is that your server behaves, as if the password authentication succeeded. You can explicitly … Read more

FTP Over SSH (SFTP) In delphi 2010

SFTP and “FTP over SSH” are two separate things, and neither involves SSL (as someone else has suggested). SFTP is a sub-protocol of SSH while “FTP over SSH” is good/bad ol’ FTP tunnelled through an SSH connection with port forwarding. Either way, what you’re after is a Delphi SSH library. I was unable to find … Read more

How to list all the folders and files in the directory after connecting through SFTP in Python

The SFTPClient.listdir returns everything, files and folders. Were there folders, to tell them from the files, use SFTPClient.listdir_attr instead. It returns a collection of SFTPAttributes. from stat import S_ISDIR, S_ISREG sftp = ssh.open_sftp() for entry in sftp.listdir_attr(remotedir): mode = entry.st_mode if S_ISDIR(mode): print(entry.filename + ” is folder”) elif S_ISREG(mode): print(entry.filename + ” is file”) The … Read more

Uploading files with SFTP

With the method above (involving sftp) you can use stream_copy_to_stream: $resFile = fopen(“ssh2.sftp://{$resSFTP}/”.$csv_filename, ‘w’); $srcFile = fopen(“/home/myusername/”.$csv_filename, ‘r’); $writtenBytes = stream_copy_to_stream($srcFile, $resFile); fclose($resFile); fclose($srcFile); You can also try using ssh2_scp_send