[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]
當此引數被修改為yes並使用/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]