Directory transfers with Paramiko

You can subclass paramiko.SFTPClient and add the following method to it: import paramiko import os class MySFTPClient(paramiko.SFTPClient): def put_dir(self, source, target): ”’ Uploads the contents of the source directory to the target path. The target directory needs to exists. All subdirectories in source are created under target. ”’ for item in os.listdir(source): if os.path.isfile(os.path.join(source, item)): …

Read more

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.

Keep Remote Directory Up-to-date

lsyncd seems to be the perfect solution. it combines inotify (kernel builtin function which watches for file changes in a directory trees) and rsync (cross platform file-syncing-tool). lsyncd -rsyncssh /home remotehost.org backup-home/ Quote from github: Lsyncd watches a local directory trees event monitor interface (inotify or fsevents). It aggregates and combines events for a few …

Read more