我正在将文件从一组不同的服务器上载到一个数据服务器。我正在使用psftp,20台以上的服务器中有1台产生权限问题。
Remote working directory is /
psftp> cd Remote_Directory\
Remote directory is now /Remote_Directory/
psftp> put C:\folders\containing\file\FILE.zip
/Remote_Directory/: open for write: failure
psftp> quit
Run Code Online (Sandbox Code Playgroud)
它看起来像是远程目录上的权限问题,但是,为什么我只在一台服务器上遇到此问题?在所有20台以上服务器上,该批处理均相同。
小智 5
PUT命令期望在目标位置的末尾有一个文件名。
请尝试以下代码
put C:\folders\containing\file\FILE.zip /Remote_Directory/FILE.zip
Run Code Online (Sandbox Code Playgroud)
错误消息中的路径是 psftp 尝试创建的远程文件的确切路径。请参阅outfname下面的代码片段:
req = fxp_open_send(outfname,
SSH_FXF_WRITE | SSH_FXF_CREAT | SSH_FXF_TRUNC,
&attrs);
...
printf("%s: open for write: %s\n", outfname, fxp_error());
Run Code Online (Sandbox Code Playgroud)
由于路径显然不正确(缺少文件名),似乎 psftp 不知何故感到困惑。我相信这可能是由于您在cd命令中使用了错误的(反)斜杠。
尝试cd Remote_Directory/。