As a first post, this one should be interesting... I'm trying to get VSFTP working on a server that I am looking after for one of our clients, and I'm having problems with getting it to work correctly. The system that I need to have is users will be able to log in and upload files to their own directories that are set in a 'root' (not root level) FTP folder. At the moment it's set up in /var/ftp/import/ with users folders set up like /var/ftp/import/michael etc. These folders also need to be readable and writable by the PHP system that's running there for the import functionality that is required. I'm using virtual users with VSFTP as this has allowed my to use my MySQL database to log users into the system. Iv'e got it set up (as far as I know) so that users are chroot'd to their own virtual home directory. That part is working fine. I am currently able to have users log in and authenticate correctly, but the error that I'm finding is that when VSFTP tries to change folders to the users virtual home I get the error Code: 500 OOPS: cannot change directory:/var/ftp/import/michael I'm relatively sure that it's to do with permissions as the folder exists. The permissions are set with the owner/group as apache/apache as this needs to be accessible by the PHP scripts. At the moment I think that's the problem, but I'm not sure if that's all it is. Does anyone have an idea of what I can try to get this working for both systems? Please keep in mind that I'm a relative n00b with Linux like this, but hopefully things ike this will help me learn for next time. I've included my VSFTP config file below for reference. Code: anonymous_enable=NO local_enable=YES virtual_use_local_privs=YES write_enable=YES local_umask=022 secure_chroot_dir=/var/run/vsftpd dirmessage_enable=YES xferlog_enable=YES connect_from_port_20=YES xferlog_std_format=YES idle_session_timeout=600 data_connection_timeout=120 ftpd_banner=Welcome to *** FTP service. listen=YES pam_service_name=vsftpd guest_enable=YES tcp_wrappers=YES user_sub_token=$USER local_root=/var/ftp/import/$USER chroot_local_user=YES hide_ids=YES file_open_mode=0666
After working through this, I have found the answer myself!! It turns out that i had the folders permissions set incorrectly. The permissions meed to be set as 0777 for folders that I want to write to, and 0755 for folders that I want to read from but not write to. Now I've just got to figure out the ownership of the files when they are transferred, but that should be relatively easy compared to the rest of this.