I have a HostGator dedicated server running CentOS. I have a folder on one user's account where I want all users to be able to have read access, so we keep it chmod'd to 755. HG has a script that runs and changes these permissions. I had them disable that script, but they also changed an attribute so that the folder was append only, making it impossible to delete a file. They gave me the command to toggle that attribute, but I don't want to have to open a shell every time I want to delete a file from FTP. Is there another way of making it so that I can use that directory like normal, but prevent the permission from being changed?
EDIT: After a little back and forth, HG and I have come up with this cronjob that isn't quite right yet. I have an open ticket with them, but sometimes this awesome community is faster.
if [[ "stat -c "\%a" /home/user/folder" != "755" ]]; then echo -e "Perm Changed\n" $(stat /home/user/folder) "\n" | mail -s "cron" [email protected]; chmod 755 /home/user/folder; fi
The conditional statement isn't correct and I suspect the quotation marks are out of place but I don't know enough of this syntax to be sure. Can anyone spot the error here? It is supposed to check the permission of the folder. If they are not 755, then send an email and change the permissions. What I get is as if the condition is alway true.
ls -Zon the directory and post the output. This will give you permissions, ownership, and SELinux details. You may be able to set something up using SELinux to do what you're thinking. Also, you could change the user ownership to your user, create a group to put the other users in, and change the group ownership to that group. Then modify the permissions for the group accordingly. Scripts that run as root, though, will still have full access unless set under a restricted SELinux property or chmodding it to 000 like they've already done, which won't allow it to run.