I have a vmail directory manage by postfix with the permissions set like this:
- user: vmail
- group: vmail
- permission 700
I need to get the size of that directory with PHP. To do this, I'm using that code:
$io = popen('/usr/bin/du -sk '.$directory, 'r');
It work pretty well for the directories manage by PHP but not with the vmail directory because of the permissions.
The best solution that come to my mind is changing the user of the vmail directory to www-data.
What I'd like to know is what you guys think of this solution and if you think to a better solution to do it without reducing the security ?