Search code examples
linuxapachecentossamba

virtual centOS 6.2 - How to share /var/www using Samba


I have Windows XP, installed VirtualBox, and have now a centOS virtual machine. I am sharing folders between the two machines using Samba.

I have successfully accessed shared folders in the Home directory. My problem now is how do I access /var/www? (I have exactly the same setting with home directories in smb.conf except path).

Thanks in advance.

enter image description here


Solution

  • You must add such section to the smb.conf:

    [www]
       comment = Web Root Dir
       path = /var/www
       valid users = user
       public = no
       writable = yes
       printable = no
    

    User user must exist in the system and in Samba (added by smbpasswd -a user). Of course you can use other username.

    Check if your user user can access this filesystem in Linux (without samba). If it can't you must give him access rights in Linux.