【问题标题】:Unable to ignore errors using psftp使用 psftp 无法忽略错误
【发布时间】:2020-04-12 23:38:28
【问题描述】:

我希望将本地 Windows 上 C:\Users\myuser\Downloads\SFTP 文件夹中的所有文件上传到远程 SFTP 服务器的 myfolder 目录。

下面是我的命令:

C:\putty\psftp.exe -b C:\putty\sftp_commands.txt -l myuser -pw mypass 10.8.44.86

这是我的C:\putty\sftp_commands.txt 文件:

mkdir myfolder
cd myfolder
lcd "C:\Users\myuser\Downloads\SFTP"
mput "C:\Users\myuser\Downloads\SFTP\*.*"

运行命令会出现以下权限被拒绝错误:

C:\Users\myuser\Desktop>C:\putty\psftp.exe -b C:\putty\sftp_commands.txt -l myuser -pw mypass 10.8.44.86
Using username "myuser".
Pre-authentication banner message from server:
| EFT Server Enterprise 7.3.2.8
End of banner message from server
Keyboard-interactive authentication prompts from server:
End of keyboard-interactive prompts from server
Remote working directory is /
mkdir /myfolder: permission denied

然后我决定通过使用 psftp 的 -be 参数来忽略错误。这不起作用,我在输出中看到以下错误。

C:\Users\myuser\Desktop>C:\putty\psftp.exe -be C:\putty\sftp_commands.txt -l myuser -pw mypass 10.8.44.86
PuTTY Secure File Transfer (SFTP) client
Release 0.73
Usage: psftp [options] [user@]host
Options:
  -V        print version information and exit
  -pgpfp    print PGP key fingerprints and exit
  -b file   use specified batchfile
  -bc       output batchfile commands
  -be       don't stop batchfile processing if errors
  -v        show verbose messages
  -load sessname  Load settings from saved session
  -l user   connect with specified username
  -P port   connect to specified port
  -pw passw login with specified password
  -1 -2     force use of particular SSH protocol version
  -4 -6     force use of IPv4 or IPv6
  -C        enable compression
  -i key    private key file for user authentication
  -noagent  disable use of Pageant
  -agent    enable use of Pageant
  -hostkey aa:bb:cc:...
            manually specify a host key (may be repeated)
  -batch    disable all interactive prompts
  -no-sanitise-stderr  don't strip control chars from standard error
  -proxycmd command
            use 'command' as local proxy
  -sshlog file
  -sshrawlog file
            log protocol details to a file

C:\Users\myuser\Desktop>

您能否建议我的代码有什么问题?

【问题讨论】:

    标签: error-handling sftp putty mkdir psftp


    【解决方案1】:

    -be-b 是独立的开关。所以应该是:

    psftp.exe -be -b C:\putty\sftp_commands.txt ...
    

    【讨论】:

      猜你喜欢
      • 2018-06-21
      • 1970-01-01
      • 2019-11-19
      • 2016-12-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-13
      • 2023-03-23
      • 1970-01-01
      相关资源
      最近更新 更多