Reputation: 1553
I have a very simple page attempting to shell_exec to initiate a smbclient.
The line works fine in interactive shell, but fails in the browser.
Interactive Shell
[root@vle html]# php -a
Interactive shell
php > $exec = exec("smbclient //*IP*/*Share* -U *Username*%*Password*");
Domain=[...] OS=[Windows Server 2012 Standard 9200] Server=[Windows Server 2012 Standard 6.2]
This works as intended. However, when doing it in a PHP file, powered by Apache I get this:
Test PHP File executed in browser
<?php
$exec = exec("smbclient //*IP*/*Share* -U *Username*%*Password");
print_r($exec);
// returns Connection to *IP* failed (Error NT_STATUS_ACCESS_DENIED)
?>
When attempting to use libsmbclient for php I get the following error:
Warning: Couldn't open SMB directory smb://IP/Share: unknown error (110)
Does anyone have any ideas what could be causing it to work in interactive shell but not in the browser?
Server is CentOS 6
UPDATE
I've narrowed the issue down to being caused by SELinux (I temporarily disabled it).
Does anyone know how to permit smbclient through selinux?
Upvotes: 0
Views: 849