Protected directories

Hello All,

In Virtualmin I am trying to create a protected directory. However, I keep getting the following error:
Failed to protect new directory : Failed to open /home/main/domains/ for writing : Permission denied at …/ line 1376.

If anyone knows how to fix this I would appreciate it.



At what point do you receive that error?

Also, what is the output of this command:

ls -ld /home/main/domains/

the ls -ld command displays
drwxrwxr-x 3 www-data www-data 4096 Oct 13 15:12 /home/main/domains/

I get the error after clicking on services -> protected directories -> add protection for a new directory -> Select Sub-Directory -input the “cp” without quotes in field -> type message in Authentication realm -> Click create -> Then get error

Thanks for the Help

Ah, it looks like the /home/main/domains/ directory is owned by the www-data user, rather than the Virtual Server owner.

You would want to change the owner of that directory to be the Virtual Server owner… you can do that with this command:

chmod USERNAME /home/main/domains/

Eric meant to say “chown” for the last command he posted, not “chmod”. :slight_smile: chown modifies the owner, chmod the access rights.

(Eric of course knows that, he certainly just mixed the two commands up.)

Thanks Everyone,

This solved the issue. Greatly appreciate it.

I’m glad Locutus is here to catch my typos, or we’d be working on two problems now :slight_smile:

It’s good to hear you got it working, thanks for the update!