Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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'm a beginner when it comes to Linux, and have recently put together a media server, holding all my movies, running Ubuntu 12.04.

After following tutorials and forums I can successfully ping, by hostname and IP, my windows desktop box and my media server Ubuntu box fine, and vice versa.

I've configured Samba to set up a share called Movies on my media server. I also set up an account on Samba using my Linux username, windows username with my Linux password.

My Ubuntu box is now visible on my network tree on my win7 box, as is the Movies share. however when I try to access the Movies share from the win7 box I do not have permission to do so.

I noticed that by using the static IP address I issued my Ubuntu media server, I can access the share with ease.

However I would like to be able to resolve the issue and access the share using the hostname of my Ubuntu media server box.

Sorry if I'm a bit unclear in my set up!

share|improve this question
up vote 9 down vote accepted

There are a couple of issues that could lead to this:

  1. Enabling Netbios in your samba configuration file

    in your /etc/samba/smb.conf file, after the WORKGROUP line, add the following:
    netbios name = PC_NAME Where PC_NAME is the name of your PC as it will show in the network. Then reset the samba service sudo service smbd restart

  2. Not having STATIC IP

    Need to have static IP set in order for other PCs on that network to see you. This also depends on your router and the configuration of your network.

  3. Hostname length should be less than 15 characters

    If your hostname is longer than 15 characters it will give an error in some cases. Type hostname to see your hostname. To change it you can either:

    sudo sysctl kernel.hostname=NAME

    or you can edit the /etc/hostname file and reboot.

  4. In the /etc/samba/smb.conf file, look for the line that says the following:

    # What naming service and in what order should we use to resolve host names
    # to IP addresses
    ;   name resolve order = lmhosts host wins bcast

    Uncomment the line that says name resolve order and make sure that bcast is the first on in the list, should look like this afterwards:

    name resolve order = bcast lmhosts host wins

    Then restart the Samba service as I mentioned above.

This is all assuming it is Ubuntu the problem, you have already Samba installed and you are not working through Active Directory.

In many case it is also Windows. You would need to do stuff like flush the DNS and the register to it. On Windows in the terminal (cmd) do the following:

ipconfig /flushdns
ipconfig /registerdns

You need to reboot the PC afterwards. After this, check to see if you can see the Ubuntu PC by doing for example net view in Windows.

share|improve this answer
Fantastic reply Luis!! All I did was enter the netbios line with the name of my ubuntu box and it worked straight away - thanks! – user1139093 Jan 15 '13 at 14:01
Glad it worked, I put several options because depending on the network configuration, Windows version, how the router was set up, etc.. the solution might change. I know there are other options but this are the ones I have done over the years. – Luis Alvarado Jan 15 '13 at 17:20

In my case I had to restart the nmbd service

sudo systemctl restart nmbd
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.