FTP on Juniper MX Series – Configuration and Setup

juniperjuniper-junostftp

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

Best Answer

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

Related Topic