I had a problem with my ftp server. After login I cannot upload files on my root directory.
After logged into my ftp server i check permission for my user in my home folder.
[root@ftp home]# ll dr-xr-x---. 69 myuser ftp 4096 17 nov 17.17 myftphome [root@ftp home]#
Now I thought it was only necessary to add write permission to myftphome folder to resolve the issue. I was wrong.
[root@ftp home]# chmod 750 myftphome [root@ftp home]# ll drwxr-x---. 69 myuser ftp 4096 17 nov 17.17 myftphome [root@ftp home]#
Now I try again to login into ftp server but i got this error:
vsftpd: refusing to run with writable root inside chroot
I suggest two different solution to this problem.
If you don’t have multiple user in your ftp server or if you don’t care about users, you can enable write permission in root folder globaly.
Edit vsftpd.conf adding this line:
allow_writeable_chroot=YES
To be honest I prefer to have control to which users have the right to write in their root (home) directory.
To do it edit vsftpd.conf file:
chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftpd/chroot_list
Now create /etc/vsftpd/chroot_list file with the list of the users you need to give write permissions:
[root@ftp home]# vim /etc/vsftpd/chroot_list myuser anotheruser
Remember to restart vsftpd:
Centos 6 or less:
service vsftpd restart
Centos 7
systemctl restart vsftpd