Friday, February 19, 2016

Owncloud mount cifs with selinux and apache read on cifs file

#/usr/sbin/getsebool -a | grep httpd

if httpd_use_cifs is off

#setsebool -P httpd_use_cifs on

Mount Cifs share

mkdir /home/youruser/public_html/mnt-cifs-foldername

if you use selinux please check httpd_user_conntent_t by

#ls -lZ /home/youruser/public_html/mnt-cifs output apache apache system_u:object_r:cifs_t:s0 change system_u to httpd_user_content_t

#semanage fcontext -a -t httpd_user_content_t /home/youruser/public_html/mnt-cifs #restorecon -vr /home/youruser/public_html/mnt-cifs

 and ls -lZ see again and then mount cifs Command share path mount to folder local User (on php script use apache), User access cifs share

#mount.cifs // /home/your-user/public_html/owncloud/data/admin/files/mnt-cifs -o user,uid=48,gid=48,user=myuser_share,password=mypassword 0 0

 * you can see user(uid) and group id (gid) on

#cat /etc/passwd
 my apache user use id 48 groupid 48
you can test copy file test.txt to and check file on /home/your-user/public_html/owncloud/data/admin/files/mnt-cifs if you see file on mount path cifs is done and after go to configure on Owncloud, Login as admin user

 3 config local mount path
4 owncloud user acces to mount

No comments:

Post a Comment