I've got minimal experience with linux systems, I need to test a web page in the environment its going to be hosted in so I set up a test server and tried to use samba for convenient access to the hosted files.

So far what I've done is:

  1. minimal CentOS 7 install
  2. installed apache, mysql, php, nano and samba
  3. enabled and started the services for all of those where applicable
  4. let apache and samba through the firewall
  5. adduser --system samba_user
  6. chown -R samba_user /var/www/html
  7. chmod 777 for /var/www/html
  8. edited my smb.conf to look like this exactly:


    workgroup = WORKGROUP
    netbios name = test_server
    security = USER
    map to guest = bad user

    path = /var/www/html
    public = yes
    browsable = yes
    writeable = yes
    read only = no
    create mask = 0777
    directory mask = 0777
    force user = samba_user

and restarted the samba service using systemctl restart smb.service (and after every smb.conf modification attempt in general)

It did not go in that neat order but rather with some hair pulling over several hours but that's what it essentially distills down to. I know I'm being overly generous with security permissions but I really need no security right now, I'll settle for it just working. The contents of smb.conf I pieced together from various guides/forum threads and sambas own documentation.

The whole apache/mysql/php works fine but every time I try to access the shared directory in my win 7 machine, it says I have no permission to access it.

I can see the test_server in network, I can even access it and see the html directory (after adding map to guest = bad user to smb.conf) but no matter what I try, I can't get into that folder.

I also tried these since it seemed to pop up a lot with other peoples win 7 samba access problems

lanman auth = no
ntlm auth = no
client ntlmv2 auth = yes

but removed those lines since according to samba documentation, those are the default values anyway

I also edited win 7 security policies to enable ntlm and plaintext passwords but no effect for either.

Is there anything I'm missing? Anything else to try?


Turns out it was SELinux denying samba access to /var/www/html, found some options to deal with it here: https://serverfault.com/questions/131105/how-do-i-get-selinux-to-allow-apache-and-samba-on-the-same-folder

  • Instead of submitting your solution within the body of your question you should submit an answer. – Ramhound Jan 22 at 4:16

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.