sftp

save the result of ls command in the remote sftp server on local machine

孤者浪人 提交于 2020-01-16 01:07:12
问题 I have seen This question but I am not satisfied with answer. I connect to remote sftp server and I will do ls there I want to have the result of ls on my local machine. I don't want any thing extra to be saved, only the result of ls command. Can I save the result to a variable accessible on the local machine? #!/usr/bin/expect spawn sftp myuser@myftp.mydomain.com expect "password:" send "mypassword\n"; expect "sftp>" send "ls\n" //save here interact 回答1: Here's how I would do it, with a more

Java8 + Jcraft = Key is too long for this algorithm

社会主义新天地 提交于 2020-01-15 07:37:26
问题 We are using JCraft / Jsch for sftp file transfer. http://www.jcraft.com/jsch This has worked excellent for several years with Java6 and Java 7. But then we upgraded to Java 8 and it worked fine in our test environment, but it failed in our QA environment. Then it failed against a remote SFTP server. This SFTP server uses 'SSH-2.0-4.2.0.21 SSH Secure Shell Windows NT Server' We have no control over this server. I googled a little and found out that some suggests that the source of the problem

Bash Script: Send files to SFTP using Expect

╄→尐↘猪︶ㄣ 提交于 2020-01-15 07:30:27
问题 I have to send few gzipped files from local server to SFTP server. My Server Info Distributor ID: Ubuntu Description: Ubuntu 12.04.4 LTS Release: 12.04 Codename: precise Created a bash script and could able to send files to sftp, but i want to send email if transfer is successful. #!/bin/bash HOST=hostname.domain PORT=22 USER=username PASSWORD=password SOURCE_FILE=path/filename TARGET_DIR=PATH /usr/bin/expect<<EOD spawn /usr/bin/sftp -o Port=$PORT $USER@$HOST expect "password:" send "

Use SFTP instead of FTP in older version of C# (2010 Express)

一曲冷凌霜 提交于 2020-01-14 06:13:05
问题 I have to change an older C# script (created back in 2010 in C# Express) to use SFTP instead of FTP. It took some doing to get this script out of an old repository - and to download a version of C# 2010 Express to get the script open! But I finally managed it. I have never coded in C# so please be kind. We have several off-site PCs that need to transfer files to and from the server on their network. This script is a .dll which is referenced in several other programs on these systems, so I'll

Python pysftp.put raises “No such file” exception although file is uploaded

馋奶兔 提交于 2020-01-14 04:29:06
问题 I am using pysftp to connect to a server and upload a file to it. cnopts = pysftp.CnOpts() cnopts.hostkeys = None self.sftp = pysftp.Connection(host=self.serverConnectionAuth['host'], port=self.serverConnectionAuth['port'], username=self.serverConnectionAuth['username'], password=self.serverConnectionAuth['password'], cnopts=cnopts) self.sftp.put(localpath=self.filepath+filename, remotepath=filename) Sometimes it does okay with no error, but sometime it puts the file correctly, BUT raises the

Paramiko put method throws “[Errno 2] File not found” if SFTP server has trigger to automatically move file upon upload

China☆狼群 提交于 2020-01-14 04:19:25
问题 I'm calling the Paramiko sftp_client.put(locapath,remotepath) method This is throwing the [Errno 2] File not found error below. 01/07/2020 01:12:03 PM - ERROR - [Errno 2] File not found Traceback (most recent call last): File "file_transfer\TransferFiles.py", line 123, in main File "paramiko\sftp_client.py", line 727, in put File "paramiko\sftp_client.py", line 689, in putfo File "paramiko\sftp_client.py", line 460, in stat File "paramiko\sftp_client.py", line 780, in _request File "paramiko

Unable to ignore errors using psftp

不打扰是莪最后的温柔 提交于 2020-01-14 03:43:21
问题 I wish to upload all files in C:\Users\myuser\Downloads\SFTP folder on my local Windows to a remote SFTP server's myfolder directory. Below is my command: C:\putty\psftp.exe -b C:\putty\sftp_commands.txt -l myuser -pw mypass 10.8.44.86 Here is my C:\putty\sftp_commands.txt file: mkdir myfolder cd myfolder lcd "C:\Users\myuser\Downloads\SFTP" mput "C:\Users\myuser\Downloads\SFTP\*.*" Running the command gives the below permission denied error: C:\Users\myuser\Desktop>C:\putty\psftp.exe -b C:

Setting timelimit for sftp.get() of Paramiko module

寵の児 提交于 2020-01-13 19:14:08
问题 I am using Paramiko's SFTP client to download a file from remote server to a client(i.e. get operation) The file to be transferred is a bit huge ~1GB. So I would like the get operation to timeout if the time is more than 10s. But setting the timeout value for connect doesn't work, It appears to be the timeout for just creating the SSH connection and not the timeout for the whole ssh connection. ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect

Reading file opened with Python Paramiko SFTPClient.open method is slow

↘锁芯ラ 提交于 2020-01-13 18:01:10
问题 I am trying to remote read a netcdf file. I used paramiko package to read my file, like this: import paramiko from netCDF4 import Dataset client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(hostname=’hostname’, username=’usrname’, password=’mypassword’) sftp_client = client.open_sftp() ncfile = sftp_client.open('mynetCDFfile') b_ncfile = ncfile.read() # **** nc = Dataset('test.nc', memory=b_ncfile) But the run speed of ncfile.read() is

Setting the extended file attributes using SSH.NET SftpClient

纵然是瞬间 提交于 2020-01-13 17:58:28
问题 I am trying to use the extended file attribute to store some information after I uploaded a file into remote machine (Ubuntu 16.04 LTS) from Windows using Renci SSH.NET SFTP library. But the attributes are not getting preserved? This how I am trying to set the extended attributes SftpFileAttributes fileAttrs = sftpClient.GetAttributes(remoteFilePath); IDictionary<string, string> additionalAttrs = new Dictionary<string, string>(); additionalAttrs.Add(new KeyValuePair<string, string>("user.from