sftp

phpseclib sftp->put() command: File contents are just a string, not the expected PDF document

与世无争的帅哥 提交于 2020-04-11 08:23:09
问题 I'm trying to upload a PDF document from a stage server to a remote location using $sftp-put(); CODE: $sftp = new SFTP($config::SFTP_SERVER); // login to remote server if (!$sftp->login($config::SFTP_USER, $config::SFTP_PASSWORD)) { throw new Exception('Login failed'); } // move to relevant directory $sftp->chdir('fatca'); // upload file $uploadFile = $sftp->put('test-pdf-upload.pdf', '/srv/www/vhosts/stage.johno.com/fatca/src/uploads/pdfs/345-553453-434__05122017_16:45:26.pdf', NET_SFTP

phpseclib sftp->put() command: File contents are just a string, not the expected PDF document

风流意气都作罢 提交于 2020-04-11 08:23:06
问题 I'm trying to upload a PDF document from a stage server to a remote location using $sftp-put(); CODE: $sftp = new SFTP($config::SFTP_SERVER); // login to remote server if (!$sftp->login($config::SFTP_USER, $config::SFTP_PASSWORD)) { throw new Exception('Login failed'); } // move to relevant directory $sftp->chdir('fatca'); // upload file $uploadFile = $sftp->put('test-pdf-upload.pdf', '/srv/www/vhosts/stage.johno.com/fatca/src/uploads/pdfs/345-553453-434__05122017_16:45:26.pdf', NET_SFTP

phpseclib sftp->put() command: File contents are just a string, not the expected PDF document

折月煮酒 提交于 2020-04-11 08:23:06
问题 I'm trying to upload a PDF document from a stage server to a remote location using $sftp-put(); CODE: $sftp = new SFTP($config::SFTP_SERVER); // login to remote server if (!$sftp->login($config::SFTP_USER, $config::SFTP_PASSWORD)) { throw new Exception('Login failed'); } // move to relevant directory $sftp->chdir('fatca'); // upload file $uploadFile = $sftp->put('test-pdf-upload.pdf', '/srv/www/vhosts/stage.johno.com/fatca/src/uploads/pdfs/345-553453-434__05122017_16:45:26.pdf', NET_SFTP

linux主机连接sftp报错received unexpected end-of-file fro

我是研究僧i 提交于 2020-04-03 23:29:06
SFTP 连接主机失败,提示信息如下: 登陆目标主机,编辑查看 /etc/ssh/sshd_config 文件,找到 Subsystem 关键字 替换为 Subsystem sftp internal-sftp 重启sshd服务再次连接即可。 来源: 51CTO 作者: weimeng3410 链接: https://blog.51cto.com/14757092/2484819

python paramiko的使用介绍

三世轮回 提交于 2020-03-03 17:38:41
一: 使用paramiko #设置ssh连接的远程主机地址和端口 t=paramiko.Transport((ip,port)) #设置登录名和密码 t.connect(username=username,password=password) #连接成功后打开一个channel chan=t.open_session() #设置会话超时时间 chan.settimeout(session_timeout) #打开远程的terminal chan.get_pty() #激活terminal chan.invoke_shell() 然后就可以通过chan.send('command')和chan.recv(recv_buffer)来远程执行命令以及本地获取反馈。 二: paramiko的两个模块介绍 paramiko有两个模块SSHClient()和SFTPClient() SSHClient()的使用代码: import paramiko ssh = paramiko.SSHClient() # 创建SSH对象 # 允许连接不在know_hosts文件中的主机 ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # 连接服务器 ssh.connect(hostname='192.168.2.103', port=22,

How to list all subdirectory using nodeJS SFTP client?

拥有回忆 提交于 2020-03-02 11:59:06
问题 Amusing node JS ssh2-sftp-client. I want to the list all the directory and its subdirectories in a given path? let sftp = new ssh2SftpClient(); console.log(sftp); sftp.connect({ host: 'xx.xxx.xxx.xxx', port: '22', username: 'centos', privateKey: require('fs').readFileSync('/home/myHome/aws_int.ppk') }).then(() => { return sftp.list('/home/centos/myHome'); }).then((data) => { console.log('the data info : ' + data); for(i = 0; i < data.length; i++) { console.log(data); console.log(data[i].name)

golang通过ssh实现远程文件传输

不问归期 提交于 2020-02-24 23:13:46
使用ssh远程操作文件, 主要是创建ssh, 直接上代码 import ( "fmt" "github.com/pkg/sftp" "golang.org/x/crypto/ssh" "net" "strconv" "time")func SftpConnect(user, password, host string, port int) (sftpClient *sftp.Client, err error) { //参数: 远程服务器用户名, 密码, ip, 端口 auth := make([]ssh.AuthMethod, 0) auth = append(auth, ssh.Password(password)) clientConfig := &ssh.ClientConfig{ User: user, Auth: auth, Timeout: 30 * time.Second, HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error { return nil }, } addr := host + ":" + strconv.Itoa(port) sshClient, err := ssh.Dial("tcp", addr, clientConfig) /

pysftp vs. Paramiko

梦想与她 提交于 2020-02-20 07:23:29
问题 I have a simple requirement to drop a file on an SFTP server. I have found pysftp and Paramiko libraries that seem to allow me to this and developed a simple application using Paramiko but I can't find a proper source that compares the two so I can decide which one I can/should use. What are the pros and cons for each? 回答1: pysftp is a wrapper around Paramiko with a more Python-ish interface. pysftp interface does not expose all of the features of Paramiko. On the other hand, pysftp

vs code 搭建python环境

◇◆丶佛笑我妖孽 提交于 2020-02-04 22:36:12
文章目录 1.配置python代码提示 2.配置tab 和 空格 3.配置代码同步 SFTP 1.配置python代码提示 1.1 安装 Anaconda3,复制基础环境 # 创建一个虚拟环境叫lx,复制本地的base环境(为了不污染base,以后还能再用) conda create -n lx --clone base # 进入和退出虚拟环境 conda activate lx conda deactivate # 我的lx 路径 D:\\Dev\\Anaconda3\\envs\\lx 1.2 安装vs code 扩展插件 python 安装python插件后 配置也很简单 快捷键 Ctrl+Shift+P 输入 Python: Select Interpreter 选择 我们的虚拟环境即可 2.配置tab 和 空格 vs code 一般已经默认安装好了 文件 - 首选项 - 设置 - 搜索tab - 常用设置 勾选空格代替tab 首选项 - 设置 - 搜索tab - 常用设置 勾选空格代替tab Tab Size 4 3.配置代码同步 SFTP 安装 SFTP 扩展插件 使用 ctrl+shift+p 快捷键调出输入框,选择 SFTP:Config 回车 会在 .vscode 目录下创建一个 sftp.json 配置文件,配置如下 { "name" : "supperapp"