[local]ASR5000-2# copy /flash/test sftp://root:cisco123@10.201.251.13:22/localdisk/test Failure: "FAILED because unable to write destination",[an error occurred while processing this directive]
copy /flash/test sftp://root:cisco123@10.201.251.13:22/localdisk/test
/etc /ssh/sshd_config文件中的设置:
# Change to yes to enable tunnelled clear text passwords PasswordAuthentication no[an error occurred while processing this directive]
如果使用FTP协议,则传输成功。
解决方案
在实验中的两台Linux服务器中,可以在一台服务器上重现问题,但在另一台服务器上无法重现。测试中服务器的IP地址只有区别。
[local]ASR5000-2# copy /flash/test sftp://root:cisco123@10.201.251.5:22/localdisk/test ******************************************************************************** Transferred 22789 bytes in 0.002 seconds (11127.4 KB/sec) [local]ASR5000-2# [local]ASR5000-2# [local]ASR5000-2# copy /flash/test sftp://root:cisco123@10.201.251.13:22/localdisk/test Failure: "FAILED because unable to write destination",[an error occurred while processing this directive]
copy /flash/test sftp://root:cisco123@10.201.251.13:22/localdisk/test [local]ASR5000-2#
在检查服务器设置时,注意到/etc /ssh/sshd_config文件中两台服务器的设置有所不同。工作服务器具有以下设置:
# Change to yes to enable tunnelled clear text passwords PasswordAuthentication yes[an error occurred while processing this directive]
当此参数修改为是,并且使用/etc/init.d/ssh restart命令重新启动服务时,您可以使用SFTP成功传输文件。
[local]ASR5000-1# copy /flash/test2.cfg sftp://root:cisco123@10.201.251.13/localdisk/test2.cfg Tuesday January 19 08:11:47 PST 2016 Are you sure? [Yes|No]: yes Tuesday January 19 08:12:15 PST 2016 ******************************************************************************** Transferred 33316 bytes in 0.001 seconds (32535.2 KB/sec) [local]ASR5000-1# copy /flash/test2.cfg sftp://root:cisco123@10.201.251.5/localdisk/test2.cfg Tuesday January 19 08:13:09 PST 2016 Are you sure? [Yes|No]: yes Tuesday January 19 08:13:18 PST 2016 ******************************************************************************** Transferred 33316 bytes in 0.001 seconds (32535.2 KB/sec)[an error occurred while processing this directive]