LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Dead-simple VsFTPd anonymous read/write configuration? (https://www.linuxquestions.org/questions/linux-software-2/dead-simple-vsftpd-anonymous-read-write-configuration-868355/)

littlebigman 03-13-2011 04:26 PM

Dead-simple VsFTPd anonymous read/write configuration?
 
Hello,

I just want to configure Vsftpd to allow users to have total access to the FTP server. The server and users are all on a private LAN behind a router with no access from the Net, so I don't need any security.

The following basic configuration doesn't allow uploading files after I log on as anonymous/whatever:

/etc/vsftpd/vsftpd.conf
Code:

listen=YES
anonymous_enable=YES
local_enable=YES
write_enable=YES
xferlog_file=YES

#anonymous users are restricted (chrooted) to anon_root
#anon_root=/home/ftp/incoming
anon_root=/var/ftp
anon_upload_enable=YES
anon_mkdir_write_enable=YES

#chroot_local_user=NO
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd.chroot_list

Here's what happens when I log on as anonymous/whatever and try to upload a file:
Quote:

> ftp server
Connected to server.
220 (vsFTPd 2.0.5)
Name (server:root): anonymous
331 Please specify the password.
Password:<whatever>
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.

ftp> ls -al
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x 3 0 0 4096 Mar 13 11:19 .
drwxr-xr-x 3 0 0 4096 Mar 13 11:19 ..
drwxr-xr-x 2 0 0 4096 May 25 2010 pub
226 Directory send OK.

ftp> put /var/tmp/ftp
local: /var/tmp/ftp remote: /var/tmp/ftp
200 PORT command successful. Consider using PASV.
553 Could not create file.
Google didn't return a really simple way to configure things. Does someone know?

Thank you.

grover 03-13-2011 05:50 PM

With my system I had to do the following:

chmod u+w /var/ftp/pub/

Then I was able to upload to the pub/ directory. For /var/ftp this does not work, because
vsftpd refuses to start if its root (/var/ftp) has write permissions for anonymous users.

Greetings, hope this help.

littlebigman 03-14-2011 03:40 AM

Thanks, but I already had /var/ftp/pub set that way:

Code:

# ll /var/ftp/
drwxr-xr-x 2 root root 4096 May 26  2010 pub

# chmod u+w /var/ftp/pub/

# ll /var/ftp/
drwxr-xr-x 2 root root 4096 May 26  2010 pub

I'm running "vsftpd-2.0.5-16.el5_5.1" on CentOS 5.5: Could it be that this issue shows with that older version, or my configuration file is wrong?

grover 03-14-2011 05:37 AM

Quote:

Originally Posted by littlebigman (Post 4290002)

Thanks, but I already had /var/ftp/pub set that way:

OK, but in your ftp exmaple above you didn't change into the pub directory first.
Did you actually try it with changing into the directory pub/ first?

Quote:

I'm running "vsftpd-2.0.5-16.el5_5.1" on CentOS 5.5: Could it be that this issue shows with that older version, or my configuration file is wrong?
Well, my version is vsftpd-2.2.2-4mdv2010.1

I copied your configuration and it worked (in the directory pub/).


What does your vsftpd.log say ?

littlebigman 03-14-2011 07:13 PM

Thanks for the help. This simple configuration works ok: After logging as ftp or anonymous, I can succesfully upload files to /var/ftp:

Code:

listen=YES
anonymous_enable=YES
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES

Thanks again for your help.

Edit: You must also make sure "ftp" owns the directory:

chown -R ftp.ftp /var/ftp/

If owned by root.root, you'll get this when trying to upload a file: "553 Could not create file"


All times are GMT -5. The time now is 06:58 PM.