0

There seem to be as many different answers to this question as there are questions themselves! Setting up Apache2 (v2.4.41) and allowing it to create and use www-data isn't in itself the issue and that's what I have and need as some Web-based applications I am building need to be able to write to files. I had myself as the user but then it was impossible to open a file in the browser as writable and with www-data it is but I cannot save my programing in the desktop text editor.

However, how do I do this AND still be able to save files I'm working on in my desktop application along with being able to copy and move files and folders? I can't seem to find a way to do both.

Right now, ls -l shows this which lets me open writable files in a browser-based form:

drwxrwsr-x 15 www-data www-data 4096 Dec 26 12:14 html

but with this I cannot open files in the browser in a writable way:

drwxrwsr-x 15 don www-data 4096 Dec 26 12:14 html

. . . and with this, as above, I can edit and work on my files in my desktop editor but the Web server cannot write to them.

drwxrwsr-x 15 don don 4096 Dec 26 12:14 html

I have added myself to the www-data group but it seemed to make no difference. Any ideas?

1 Answer 1

0

Why don't you do a:

chown don.www-data html

Or:

chown www-data.users html
adduser don users
4
  • I realized that your code wasn't recursive so when I tried sudo chown -R don.www-data /var/www/html I can now save files in my desktop editor but they are no longer writeable from the site's programming. Using chown www-data.users -R /var/www/html the files are browser-writeable but I cannot do so using my desktop editor. I need to be able to do both and that's where I am having the problem!
    – DonP
    Jan 12, 2020 at 20:32
  • I've been having to change ownership back and forth between editing and testing which is a real pain! Any ideas?
    – DonP
    Jan 13, 2020 at 18:34
  • try also a chmod -R 775 /var/www/html and you need to add don to the users group! Here is a good explanation of linux file permissions. guru99.com/file-permissions.html Jan 14, 2020 at 13:46
  • I was under the impression that folders were supposed to be 755 and I am already added to the www-data group. However, I tried 775 and changed back to www-data.www-data while in the middle of copying over some files and immediately got permissions errors. I’ll check the link that was provided to see if it sheds any light but I believe it is one of many that I’ve already read.
    – DonP
    Jan 14, 2020 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .