1

Has anyone successfully used FTP on a Juniper Device. reading their documentation, the method of using it is:

file copy <source> <destination>

in my case:

file copy /var/tmp/testdoc ftp://user:pass@hostname/user/home/

But I keep getting the following error:

fetch: ftp://user:*@hostname/user/home/: File unavailable (e.g., file not found, no access)
error: put-file failed
error: could not send local copy of file

I know the file is available, and it can see it because when i change the file name in the command (put in a non-existent file), it says no such file or directory exists.

I have tried it the other way around as well (from the server to the rotuer) but I get error: file-fetch failed instead.

This is extremely frustrating as there is no documentation on this error.

EDIT: The FTP is between the Juniper router and a Linux server. I also tried going down to the file name itself: file copy /var/tmp/testdoc.txt ftp://user:pass@hostname/user/home/testdoc.txt

  • It looks like you are trying to copy a file to a directory. Try putting the actual file name at the end of the destination directory. – Ron Maupin Jul 11 '16 at 19:36
  • tried that as well, still gives the same error – user2883071 Jul 11 '16 at 19:37
1

Before attempting to copy your file, you should first create the file on the server where it is being copied, set permissions so that it can be overwritten, and specify it in the copy path. Please also check that you have that directory accessible via ftp.

touch testdoc.txt
chmod 777 testdoc.txt

(Example permission You may want to be more restrictive)

file copy /var/tmp/testdoc.txt ftp://user:pass@hostname/user/home/testdoc.txt

Alternatively you can also use ftp in the following way (again following creation and permissions set):

From Server:

ftp juniperdevice.mynetwork.net
get /var/tmp/testdoc.txt testdoc.txt
quit ftp

Additional items to check:

Official Documentation: http://www.juniper.net/documentation/en_US/junos15.1/topics/reference/command-summary/file-copy.html

| improve this answer | |
1

This is extremely stupid, and not at all explained. When using the FTP command, if one hard codes the server path, IT WILL NOT WORK.

Therefore, although this makes sense: file copy /var/tmp/testdoc ftp://user:pass@hostname/user/home/

The correct command is: file copy /var/tmp/testdoc ftp://user:pass@hostname

And the file will pop-up in that users folder. Extremely stupid.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.