ColdFusion folder permission is read-only

ColdFusion 10 is currently running, but this problem has been a constant problem for many years, possibly on all CF6 / 7.

As part of the CMS, part of the verification is that the images are uploaded to the directory, for example.

<cffile action="UPLOAD" filefield="image" destination="media/img/" nameconflict="MAKEUNIQUE" accept="image/jpeg,image/gif,image/pjpeg" mode="644"> 

They are then read using a script that checks the sizes.

If all goes well, the script process moves it to the destination directory, for example.

 <cffile action="MOVE" source="media/img/imagename" destination="media/img/#hexdir#/imagename" mode="644"> 

If it fails, it should be deleted.

 <cffile action="DELETE" file="media/img/imagename"> 

From time to time, the directory / img / becomes read-only; the file cannot be written. But I can not determine the reason for this.

Is there a mistake that I don't know about? any ideas?

thanks

Additional Information

I decided to use CFDirectory to change the folder resolution in the script, so it can be quickly resolved if this happens again.

I found two questions

On UNIX and Linux, cfdirectory action = "list" does not return any information in the mode column.

Besides

Using a rename folder with permissions of 644,777,111 does not seem to affect the permissions of the folder that I can view in FileZilla.

Could this mean that CF could not change the resolution of the folder in the first place?

+5
source share
1 answer

It looks like you are using ColdFusion on a Linux server. To do this, I suggest you read the auditd tool and use it to browse your directory to find out what causes the change. This will give you the process that causes the change, but if it's ColdFusion, you still have to keep track of the CFM / CFC that causes the change.

Be warned that your audit trail may become noisy if you constantly move files from and to the directory.

Assuming your img directory is similar to /mnt/media/img , just add the rule to /etc/audit/audit.rules as shown below and restart the daemon:

 -w /mnt/media/img 

Then you can clear (or set) the read-only bit for this folder and see it in the log (probably: /var/log/audit/audit.log)

 type=SYSCALL msg=audit(1407866490.247:114): arch=c000003e syscall=268 success=yes exit=0 a0=ffffffffffffff9c a1=17be0f0 a2=1ff a3=4000 items=1 ppid=2859 pid=3069 auid=1001 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=2 comm="chmod" exe="/usr/bin/chmod" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null) type=CWD msg=audit(1407866490.247:114): cwd="/root" type=PATH msg=audit(1407866490.247:114): item=0 name="/media/mnt/img" inode=6171184 dev=fd:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:httpd_sys_content_t:s0 
+2
source

Source: https://habr.com/ru/post/1200126/


All Articles