LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to configure ftp server that other computer can download files from it using curl? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-configure-ftp-server-that-other-computer-can-download-files-from-it-using-curl-4175584317/)

dudengke 07-11-2016 05:30 AM

How to configure ftp server that other computer can download files from it using curl?
 
Hi all, I want to setup a ftp server that other computer can download files from it using curl command, but without password just like the linuxfoundation ftp server. My ftp server runing on Ubuntu 14.04
First, I installed the vsftpd:
Code:

sudo apt-get install vsftpd
.
Second, I configured the file /etc/vsftpd.conf as the following:
Code:

anonymous_enable=YES
no_anon_password=YES
anon_root=/home/lsb/incoming

Third, I touch a file under the directory /home/lsb/incoming, and runing
Code:

curl ftp://ip(myserver)/text.txt -o text.txt
, it said
Code:

curl: (67) Access denied: 500
But, I can get the a file from linuxfoundation ftp server, for example:
Code:

curl ftp://ftp.linuxfoundation.org/pub/lsb/base/released-all/binary/lsb-setup-4.1.0-1.noarch.rpm -o lsb-setup.rpm
It report successfully.
How can I configure the ftp server without password?

Emerson 07-11-2016 05:39 AM

Why FTP? If this is for download only use HTTP, for instance webfs is very light HTTP server, it can be configured with password, but allows downloads without password by default. You can keep your FTP server running in parallel in case you want to upload something.

jpollard 07-11-2016 06:03 AM

Depends on why "access denied" happened.

It may have nothing to do with ftp - check the files ownership/permissions/directory path...

Habitual 07-11-2016 08:54 AM

Quote:

Originally Posted by dudengke (Post 5573999)
But, I can get the a file from linuxfoundation ftp server, for example:
Code:

curl ftp://ftp.linuxfoundation.org/pub/lsb/base/released-all/binary/lsb-setup-4.1.0-1.noarch.rpm -o lsb-setup.rpm
It report successfully.
How can I configure the ftp server without password?

I can curl a file from my web server...
I don't know the answer to your query, but if this "other computer" is on your local network,
ftp may or may not be the best tool for the job.

Why ftp? is a valid Q.

What are you really trying to do?

AwesomeMachine 07-11-2016 05:46 PM

You usually can't FTP into the root directory of the server. The highest level directory defaults to
Code:

pub
. So, just use the path you have, but add "/pub/" on then end.

dudengke 07-11-2016 08:36 PM

Quote:

Originally Posted by Habitual (Post 5574084)
I can curl a file from my web server...
I don't know the answer to your query, but if this "other computer" is on your local network,
ftp may or may not be the best tool for the job.

Why ftp? is a valid Q.

What are you really trying to do?

I want to run some tests on a computer, and download some test files on other computer, so I want to setup a ftp server that can support the download.

dudengke 07-11-2016 08:37 PM

Quote:

Originally Posted by jpollard (Post 5574012)
Depends on why "access denied" happened.

It may have nothing to do with ftp - check the files ownership/permissions/directory path...

The files with
Code:

-rw-rw-rw-

dudengke 07-11-2016 08:40 PM

Quote:

Originally Posted by Emerson (Post 5574001)
Why FTP? If this is for download only use HTTP, for instance webfs is very light HTTP server, it can be configured with password, but allows downloads without password by default. You can keep your FTP server running in parallel in case you want to upload something.

OK, thanks, I try the webfs now!

dudengke 07-11-2016 09:27 PM

Quote:

Originally Posted by Emerson (Post 5574001)
Why FTP? If this is for download only use HTTP, for instance webfs is very light HTTP server, it can be configured with password, but allows downloads without password by default. You can keep your FTP server running in parallel in case you want to upload something.

I have setup the webfs server, but when I download from the server, it just some HTML file. For example, I have put a xxx.rpm under the directory /var/www,
Code:

curl http://ip(webfs server)//xxx.rpm -o xxx.rpm
The result xxx.rpm is a HTML document, ASCII text.

dudengke 07-12-2016 03:13 AM

OK, I try the apache2, just modify the /etc/apache2/sites-enabled/000-default.conf. Set the DocumentRoot to /var/www and put the files under the /var/www.

Habitual 07-12-2016 05:35 AM

Use wget for binary packages.
curl
Code:

wget http://ip/xxx.rpm -o xxx.rpm
should do it.

wpeckham 07-12-2016 05:54 AM

Just as an aside, one of the OLD ftp server packages (or ftp services written in perl or python) might serve better. VSFTP is the Very Secure FTP package, an attempt to lock down a very unsecure protocol. Trying to be Very Secure and allow unlimited download without passwords are contradictory aims.

The modern tools for this are OpenSSH services (sftp) for the server, and something like scp, pscp, or lftp for the client. If you must (and I can see possible good reasons for this) use curl, then a ftp server that does not allow uploads, but allows almost wide-open downloads from a limited folder tree, might make sense.

CURL supports tftp protocol (as well as MANY others including sftp), and is pretty easy to set up (and terribly non-secure). One might leverage tftp (which is available in *all distributions) to serve for this purpose.

I hope this helps.


All times are GMT -5. The time now is 01:10 AM.