Saturday, July 18, 2015

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



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?


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.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...