UBUNTU: ftp-server cannot change directory when user logs in

file-permissionsftppermissionsUbuntuvsftpd

I have set up a FTP-server (vsftpd) for only one client user (ftuser). This user should have access to the folder /srv/webroot/user. The folder /srv and all subfolders are owned by me. I am not in the same group like the ftpuser is. Now I have tried to implement the user's permission in the following way:

chmod 770 -R /srv
chmod 777 -R /srv/webroot/user

But when the user tries to login via ftp the FTP-server sais:

500 OOPS: cannot change directory: /srv/webroot/user

Just as a try I gave the user rights on the whole folder strcuture by

chmod 777 -R /srv

Now he not only can login but also has access to the root folder (/) and all other subfolders (i.e. /etc, /home, …).

How must I set the rights so that my user is able to login and gets only access to /srv/webroot/user?

Best Answer

If you want user to see only it's own files then you have to set "chroot"-related options in vsftpd.conf. Limiting access of ftp users with "chmod" and "chown" is a bad way. User must be able to write in its ftp-root dir to login.