Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Samba share from drupalvm guest to windows Host failed #1265

Closed
fb-multimedia opened this issue Mar 27, 2017 · 13 comments
Closed

Samba share from drupalvm guest to windows Host failed #1265

fb-multimedia opened this issue Mar 27, 2017 · 13 comments

Comments

@fb-multimedia
Copy link

fb-multimedia commented Mar 27, 2017

Issue Type

  • Bug Report / Support Request

Your OS

Host - Windows (8.1)
VirtualBox 5.1.10
vagrant 1.9.2
Drupal vm 4.3.1 : ubuntu 14.04
samba 4.3.11-Ubuntu

Full console output

Summary

Hello at all
I try to share with samba a directory on my drupal vm that can be accessible in my windows host.
I ever used this solution that work great in other Vbox, simply like this :
I install samba :
apt-get install samba
I create my shared directory with rights permissions and owner :

mkdir /var/partage
chown -R dev:dev /var/partage
chmod -R 0777 /var/partage

I add the vagrant user to samba and give a pass with :
smbpasswd -a vagrant

I configure samba :
sudo nano /etc/samba/smb.conf
change the workgroup with my windows workgroup :
workgroup = mshome
and add at the bottom :

[partage]
   comment = /var/partage
   browseable = yes
   path = /var/partage
   read only = no
   directory mask = 0777
   create mask = 0777
   valid users = vagrant

I restart samba :
sudo /etc/init.d/samba restart

Normaly I should now access in windows (8.1) to my shared repository while connect to \192.168.88.88\partage but it doesn't work at all.

I have two other vbox, one with debian and another with ubuntu 14.04 (scotchbox) using samba like this and I can browse correctly their shared folder under windows network. so I think it's a problem between samba and drupal vm.

The ufw firewall is disable on the drupal vm.
From windows cmd I can ping 192.168.88.88 and see the server with net view command table :

C:\VMs>net view
Nom de serveur         Remarque

-------------------------------------------------------------------------------
\\FB-DRUPALVM          fb-drupalvm server (Samba, Ubuntu)
\\FB-MULTIMEDIA
\\VOSTRO-200           Vostron
La commande s'est terminée correctement.

But no share
here is my testparm -s command result :

vagrant@fb-drupalvm:~$ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Processing section "[printers]"
Processing section "[print$]"
Processing section "[partage]"
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
        workgroup = MSHOME
        server string = %h server (Samba, Ubuntu)
        server role = standalone server
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:   * %n\n *password\supdated\ssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        dns proxy = No
        usershare allow guests = Yes
        panic action = /usr/share/samba/panic-action %d
        idmap config * : backend = tdb


[printers]
        comment = All Printers
        path = /var/spool/samba
        create mask = 0700
        printable = Yes
        browseable = No


[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers


[partage]
        comment = /var/partage
        path = /var/partage
        valid users = vagrant
        read only = No
        create mask = 0777
        directory mask = 0777
        directory mode = 0777

If a specialist of samba share could help It will be great cause I've investigate a lot and no way.

Thanks

@fb-multimedia fb-multimedia changed the title Samba share from guest to Host Samba share from drupalvm guest to windows Host Mar 27, 2017
@fb-multimedia fb-multimedia changed the title Samba share from drupalvm guest to windows Host Samba share from drupalvm guest to windows Host failed Mar 27, 2017
@geerlingguy
Copy link
Owner

@fb-multimedia have you looked at https://superuser.com/a/258103 ?

@geerlingguy
Copy link
Owner

@fb-multimedia
Copy link
Author

fb-multimedia commented Mar 27, 2017

hello geerlingguy,
I've try sshfs with this link https://fedoramagazine.org/vagrant-sharing-folders-vagrant-sshfs/
But performances problem are the same as default for me with timeout on composer...
On other VM the samba share from guest to host work really good and it is ready on vagrant up.
Problems are to backup the code (like database too) wich is encapsuled in the vm and to install/ configure samba. As I have tested many solutions I'm ready to make this compromise to get good performances and using great features of drupal vm.
Otherwise I must keep my actual vm solution but it's not easy to build up and provision like a drupal vm.

@geerlingguy
Copy link
Owner

@fb-multimedia - You'd need to probably do a reverse mount for it to work well. I'm going through the process of setting up a fresh BLT project this way right now, and will likely blog about it.

If you don't share the files at all (basically disable the synced folder config), then things are very fast :)

@geerlingguy
Copy link
Owner

geerlingguy commented Mar 28, 2017

I got SMB working well... documenting the process now.

One quick hint—you will need to override Drupal VM's default firewall ports list to make sure SMB can communicate with your host:

firewall_allowed_tcp_ports:
  - "22"
  - "25"
  - "80"
  - "81"
  - "443"
  - "4444"
  - "8025"
  - "8080"
  - "8443"
  - "8983"
  - "9200"
  # For reverse-mount Samba share.
  - "137"
  - "138"
  - "139"
  - "445"

@geerlingguy
Copy link
Owner

I'm going to do a full writeup tomorrow, on my blog, and then link to it here and add a link in the Drupal VM docs. It's slightly more complicated than I'd like... and I might consider adding better first-party support inside Drupal VM itself (just so you could avoid doing 2-3 steps by hand when building a new VM) if that is easy enough to do.

@AMDAndy
Copy link

AMDAndy commented Mar 29, 2017

@geerlingguy "working well" is way more than I could have expected. I tried opening up firewall ports manually when I tried setting it up but that didn't work for me. I'm looking forward to your write up. It sounds very promising!

@geerlingguy
Copy link
Owner

I'm working on this today; hopefully I'll have a blog posted by EOD.

@fb-multimedia
Copy link
Author

Super ! Merci geerlingguy !
I m impatient to read your blog.
Thanks a lot.

@geerlingguy
Copy link
Owner

geerlingguy commented Mar 29, 2017

Here's the blog post! Drupal VM on Windows - a fast container for BLT project development (includes a video that's currently uploading... give it 10 or so minutes and it should be up on YouTube).

Specifically, regarding this issue, see Configure a reverse-mounted shared folder (using Samba).

I'll make sure to update Drupal VM's docs as well before closing this issue.

@fb-multimedia
Copy link
Author

fb-multimedia commented Mar 31, 2017

Super ! grand merci, ça marche ! I 've test and the samba share is working with your settings. The force permissions on the directory was missing on my initial smb.conf :

   create mask = 0777
   directory mask = 0777
   force create mode = 777
   force directory mode = 777
   force security mode = 777
   force directory security mode = 777

Now the reverse share is OK ! and composer take 3 minutes to install D8 !
Do you think we could install samba in the config.yml with :

# Add any extra apt or yum packages you would like installed.
extra_packages:
  - sqlite
  - samba

And add a sh script to manage the smb.conf during vagrant up in the futur ?

I'm Very happy to use drupal vm as solid solution for virtual lamp server under windows and talk about it on my french blog.
Thanks again

@geerlingguy
Copy link
Owner

geerlingguy commented Mar 31, 2017

@fb-multimedia - Possibly. I already have a role (geerlingguy.samba) that installs Samba and gets it running. It would be nice to allow that role to also manage shares, and once that's in, it would just be a matter of adding samba as a new installed_extra...

@geerlingguy
Copy link
Owner

And see related issue in that role: geerlingguy/ansible-role-samba#5

oxyc pushed a commit to oxyc/drupal-vm that referenced this issue Apr 14, 2017
sonfd pushed a commit to sonfd/drupal-vm that referenced this issue May 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants