Page 1 of 1

Setting up VSFTPD to allow user to upload.

Posted: 2007/09/01 14:29:59
by John4

I'm trying to get vsftpd to run so that I can make a user account who has access to one folder and can upload, download, read, write, basically do whatever he wants in that one folder. I found a useful guide that helped me get it set up so I can log in with the user and password from an ftp client, I tried it and it works, but it won't allow me to upload. The tutorial I used is here:
and this is the part I followed after installing vsftpd:


FTP has many uses, one of which is allowing numerous unknown users to download files. You have to be careful, because you run the risk of accidentally allowing unknown persons to upload files to your server. This sort of unintended activity can quickly fill up your hard drive with illegal software, images, and music for the world to download, which in turn can clog your server's Internet access and drive up your bandwidth charges.
FTP Users with Only Read Access to a Shared Directory

In this example, anonymous FTP is not desired, but a group of trusted users need to have read only access to a directory for downloading files. Here are the steps:

1) Disable anonymous FTP. Comment out the anonymous_enable line in the vsftpd.conf file like this:

# Allow anonymous FTP?

2) Enable individual logins by making sure you have the local_enable line uncommented in the vsftpd.conf file like this:

# Uncomment this to allow local users to log in.

3) Start VSFTP.

[root@bigboy tmp]# service vsftpd start

4) Create a user group and shared directory. In this case, use /home/ftp-users and a user group name of ftp-users for the remote users

[root@bigboy tmp]# groupadd ftp-users
[root@bigboy tmp]# mkdir /home/ftp-docs

5) Make the directory accessible to the ftp-users group.

[root@bigboy tmp]# chmod 750 /home/ftp-docs
[root@bigboy tmp]# chown root:ftp-users /home/ftp-docs

6) Add users, and make their default directory /home/ftp-docs

[root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user1
[root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user2
[root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user3
[root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user4
[root@bigboy tmp]# passwd user1
[root@bigboy tmp]# passwd user2
[root@bigboy tmp]# passwd user3
[root@bigboy tmp]# passwd user4

7) Copy files to be downloaded by your users into the /home/ftp-docs directory

8) Change the permissions of the files in the /home/ftp-docs directory for read only access by the group

[root@bigboy tmp]# chown root:ftp-users /home/ftp-docs/*
[root@bigboy tmp]# chmod 740 /home/ftp-docs/*

Users should now be able to log in via FTP to the server using their new usernames and passwords. If you absolutely don't want any FTP users to be able to write to any directory, then you should set the write_enable line in your vsftpd.conf file to no:

write_enable = NO

Remember, you must restart VSFTPD for the configuration file changes to take effect.

So I can see that it was intended to only allow the user to read from the directory, I want it to be able to upload as well.
I simply left out step 8 but unfortunately that didn't work. How do I change the perms of the directory to allow writing as well?
Is there anything else I have to do to get this working? Thanks I'm a noobie to linux and am of course using centos, please explain as detailed as possible.

Setting up VSFTPD to allow user to upload.

Posted: 2007/11/07 14:22:04
by pdown85
From your quoted tutorial source did you:

# Uncomment this to enable any form of FTP write command.
# (Needed even if you want local users to be able to upload files)

Look to your user only being able to access the login directory or sub-directories, i.e. cannot move up the tree, using chroot() jail:

# Added - lock logon user in chroot() jail
# ...

You want to take a care for security: and indeed many sources will in fact advise against using FTP at all (including your tutorial source [url=][/url]!!)

I kept some crib-notes setting up VSFTP on my CentOS server: try for more info and numerous useful links.