I recently followed a guide to configure Samba but I couldn't get it configured properly. After realizing that the guide was six years out of date I thought I should start again.

I reinstalled samba by first using these commands:

sudo apt-get purge samba
sudo apt-get install samba

But after reading my configuration file (/etc/samba/smb.conf) I noticed that it was the same file, containing the same edits I had made. I then proceeded to delete the directory and then re-install samba again.

However, the directory is not replaced after re-instillation and now I don't appear to have a configuration file. How do I get it back? Or install Samba correctly?

  • 1
    Samba's configuration is managed by the package samba-common. Have you tried to purge and re-install that package? This might actually not work still, as the Debian/Ubuntu package maintainers of Samba decided to use ucf for configuration management.
    – gertvdijk
    Commented Dec 5, 2012 at 15:34
  • @gertvdijk if you provide this as an answer then I can mark it as correct.
    – Sheldon
    Commented Dec 5, 2012 at 16:16

3 Answers 3


Yes, already posted in the comments as a verified solution, but posting as an answer anyway.

Purging should indeed remove the configuration files as well, yet the configuration of the Samba server is tracked by the package samba-common, not samba. Yes, it's a bit confusing.

So, try purging and re-installing both packages like this:

sudo apt-get purge samba samba-common
sudo apt-get install samba
  • I wonder if you can help me with this one as well. I'm trying to start samba but I get unknown service. I've tried sudo /etc/init.d/samba start, sudo service smbd start but that doesn't work. Also, the /etc/init.d/samba file doesn't seem to exist.
    – Sheldon
    Commented Dec 5, 2012 at 16:33
  • There really is a file /etc/init.d/smbd in the package samba. See this. sudo service smbd restart should work. It's already started after install, so use restart.
    – gertvdijk
    Commented Dec 5, 2012 at 16:38

If you only need the smb.conf configuration file, there is no need to reinstall samba. The default copy can be found in /usr/share/samba/smb.conf. The following will copy it to /etc/samba/, replacing the file you've been editing:

sudo cp /usr/share/samba/smb.conf /etc/samba/

Maybe you don't need to reinstall samba, I was thinking reinstalling samba because I could not view my Linux Mint Machine from windows 8 machine: (I already had samba installed but not working properly.)

This worked for me:

  1. Disconnect and forget the common connection you are trying to use on both machines.

  2. Reconnect both machines retyping your password key (have it at hand or memorize it)

  3. Upgrade samba with:

    ~ $ sudo apt-get upgrade samba

In a few seconds you should be able to see your Linux machine from windows.

  • This won't do much. IF your samba installation is up to date it will do precisely nothing.
    – mc0e
    Commented Jan 10, 2017 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .