2017-05-24 60 views
3

我沒有使用SELinux,仍然無法讓apache用戶在我的緩存存儲目錄中創建文件。如果不使用chown將用戶更改爲實際的apache用戶,這可以工作嗎?Apache用戶無法在777目錄中創建文件

[[email protected] live_storage]# getenforce 
Disabled 
[[email protected] live_storage]# su -s /bin/bash -c 'touch /home/admin/live_storage/c50d02d942c0a3d.cache' apache 
touch: cannot touch ‘/home/admin/live_storage/c50d02d942c0a3d.cache’: 
Permission denied 
[[email protected] admin]# ls -lsa 
total 84 
    4 drwx------. 10 admin admin 4096 24 mei 10:32 . 
    4 drwxr-xr-x. 3 root root 4096 9 mei 11:12 .. 
    4 drwxrwxrwx 3 admin admin 4096 24 mei 10:33 live_storage 

[[email protected] live_storage]$ touch '/home/admin/live_storage/c50d02d942c0a3d.cache' 
[[email protected] live_storage]$ ls '/home/admin/live_storage/c50d02d942c0a3d.cache' 
/home/admin/live_storage/c50d02d942c0a3d.cache 
+0

在您嘗試觸摸爲apache之前是否存在'/ home/admin/live_storage/c50d02d942c0a3d.cache'文件? –

+0

@DusanBajic嗨,不,它沒有。整個目錄是空的 – JuNijland

+0

'[root @ server live_storage]#su -s/bin/bash -c'touch /home/admin/live_storage//c50d02d942c0a3d.cache'' 'touch:can not touch'/ home/admin/live_storage // c50d02d942c0a3d.cache':Permission denied' '[root @ server live_storage]#su -s/bin/bash -c'touch /home/admin/live_storage//c50d02d942c0a3d.cache'admin' '[root @服務器live_storage]#' – JuNijland

回答

1

想通了。 Apache對/home/admin目錄沒有執行權限。 chmod +x /home/admin已修復此問題