Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have recently set up a virtual machine and I want to share files between the host and the guest. Samba seems to be a perfect solution, and indeed it does all that I expect it to. However, if the host machine is not connected to the internet, the Samba server appears offline too. Can somebody show me how to make it work?

Note: ps -ef | grep smb shows that smbd -F is running, so I think the process is started properly.

EDIT: I'm using VirtualBox for the virtualization. Below is my config in /etc/samba/smb.conf (I have never changed it, comments removed for simplicity). Sharing is enabled through the GUI in nautilus.

workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
share|improve this question
What virtualization software are you using? – Michael Mrozek Sep 22 '10 at 18:52
What network setting are you using in VirtualBox? NAT, Bridged, ... – Gert Sep 23 '10 at 11:10
Why do you want to use samba instead of using the default file sharing utility in virtualbox? – Falmarri Sep 23 '10 at 19:58
the sharing utility in virtualbox is rather slow, compared to samba (when it works) – phunehehe Sep 24 '10 at 1:35
up vote 2 down vote accepted

Have you checked if changing the type of the VirtualBox network adapter makes a difference? Shut down the virtual machine, got to Settings->Network and try to change the value of "Attached to". The default is NAT, which should be fine, however if you have NAT and it doesn't work for you, you might try bridged. If you already have bridged there, try NAT.

Before doing this, you should read the information found in VirtualBox Help, Chapter 6.2. Introduction to networking modes.

share|improve this answer
I don't really understand why, but setting network to "Bridged adapter, virbr0" makes the samba server available again. Thanks! – phunehehe Sep 24 '10 at 1:42

I had a similar problem too: here what I did:

Looks like in /etc/resolv.conf I had no ip set for the local DNS nameserver, wich in my case is the rooter itself. I had a few ips of internet DNS nameservers, that point out of my network, but not to my router, so ai just added:

nameserver where is my router ip. and SAMBA works just great even when my internet conexion is down!!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.