Permission changed on my bash script

I have a bash script to backup DB. It’s on:
/home/username/web/domain/scripts/BackupDB.sh
I give it permission with chmod +x but everyday the permission reverts and I get Permission denied.
This script is run with a cronjob once a day, permissions are given by the user of that account.

What is changing the execution permision? Should I put the script on another path?

Thanks!

By default users can’t create dirs in /home/username/web/domain/

Could you please show the output of this command?

namei -l /home/username/web/domain/scripts/BackupDB.sh

I don’t know of any scheduled maintenance task used by Hestia that could change those permissions every day.

You could use /home/username/web/domain/private/

I;ve tested on my server, seems I can also create directory inside /home/username/web/domain/ But just not /home/username/web/

Hi, thanks!
I’ve moved the file to /home/user/scripts/BackupDB.sh

Cronjob this night have been ok, let’s see next night.

About namei -l, this was my previous tree:

drwxr-xr-x root               root               /
drwxr-xr-x root               root               home
drwxr-x--x username           username           username
drwxr-x--x root               username           web
drwxr-x--x username           username           domain.com
drwxrwxr-x username           username           scripts
-rwxrwxr-x username           username           BackupDB.sh

Probably not what should be :sweat_smile:

Ok.

It’s all ok but I see one “problem”, it’s not related to the issue executing the script and it’s not your fault.

Directory domain.com has 751 permissions but by default, Hestia should use 551 so the user can’t create/delete directories inside that dir. And that’s correct when adding the web domain but when rebuilding it, it changes the perm to 751 and this should only happen if you enabled directive DOMAINDIR_WRITABLE=yes

This change added this:

But when adding support to restic, this line was modified:

@eris do you know whether that change from no_symlink_chmod $DOMAINDIR_MODE to no_symlink_chmod 751 is because some requisite to restic backups? If no, let me know and I’ll open a PR to fix it.

2 Likes

Thanks a lot! It’s working now in the new path without problem!

2 Likes