默认会话文件允许

默认会话文件允许

我需要编辑会话文件的默认许可

我知道这有很高的安全风险,

默认许可证为:600

[root@server sessions]# stat sess_06pqdthgi49oq7jnlvuvsr95q1
  File: `sess_06pqdthgi49oq7jnlvuvsr95q1'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 802h/2050d      Inode: 32473090    Links: 1
Access: (0600/-rw-------)  Uid: ( 5003/     ...)   Gid: ( 5003/     ...)

我想设置默认许可0777

这是我的php.in

; The file storage module creates files using mode 600 by default.
; You can change that by using
;
;     session.save_path = "N;MODE;/path"
;
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
;session.save_path = "/var/lib/php/session"
session.save_path = "/sessions"

我已将其更改session.save_path

session.save_path = "N;644;/sessions"

新的结果是:

  File: `sess_avrc5442qjkcbd17g2qkenmit2'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 802h/2050d      Inode: 32473090    Links: 1
Access: (0700/-rwx------)  Uid: ( 5003/     ...)   Gid: ( 5003/     ...)

现在0700不是0777

为什么?

答案1

umask(0)之前试过session_start()。有更好的方法可以setacl在文件夹上执行此操作。

相关内容