January 18, 2021



Debian – Add sftp access for users to your Apache website folder

apps-gnome-ftp-iconIf you try to transfer files to your website folders (as a user) with FileZilla or any other sftp software, you most likely get write: permission denied.

To grant write access to your user, follow these steps (Ubuntu users add sudo first):
adduser username www-data
chgrp -R www-data /var/www
chmod -R g+rw /var/www

First command add the user to the www-data group. Thats the Apache2 group on Debian systems.
Second we make sure all files and sub-dirs get into the www-data group, by using the change group command (chgrp)
Third we give read and write access to all files and sub-dirs of /var/www

If you run multiple sites on your Apache server, you can of course set the permissions to just the one site instead of all sites.

Happy permissions!