There is a new version of this tutorial available for Ubuntu 16.04 (Xenial Xerus).

Samba Server installation on Ubuntu 15.10

This guide explains the installation and configuration of a Samba server on Ubuntu 15.10 (Wiley Werewolf) with anonymous and secured Samba shares. Samba is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients. Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unix servers and Windows-based clients.

1 Preliminary Note

I have fresh installed Ubuntu 15.10 server, on which I am going to install the samba server. As Samba client system, I will use a Windows Desktop to connect to the samba server and check the setup. The Windows Desktop should be in the same network so that it is able to reach the Ubuntu server. The hostname of my Ubuntu server is and the IP is

If you don't have a Ubuntu server already, follow this tutorial to get a minimal server setup as basis for this tutorial.


  • The Windows machine must be in the same workgroup. To check the value in the Windows machine run the following command at cmd prompt:
net config workstation

The output will be like this:

Your Windows machine must be in the same Workstation domain as the Ubuntu server, i.e. WORKGROUP in my case.

  • To make the windows machine reachable in Windows by its hostname, proceed like this. Open a Windows terminal in administrator mode (you can reach the administrator mode by doing a right click on the Terminal icon in the program menu) and run the following command to open the Windows hosts file:
notepad C:\\Windows\System32\drivers\etc\hosts

There you add the following red line and save the file:

[...] server1

2 Anonymous Samba sharing

Samba is available in the Ubuntu repositories. The first step is to install the Samba Server and its dependencies with apt.

apt-get install -y samba samba-common python-glade2 system-config-samba

It will install the Samba version 4.1.17-Ubuntu.

To configure samba, edit the file /etc/samba/smb.conf. I will use nano as editor and make a backup of the original file before I start to change it. The backup file is named /etc/samba/smb.conf.bak

cp -pf /etc/samba/smb.conf /etc/samba/smb.conf.bak
cat /dev/null  > /etc/samba/smb.conf

Open the Samba configuration file with nano:

nano /etc/samba/smb.conf

And add the following lines.

workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu
security = user
map to guest = bad user
dns proxy = no

#============================ Share Definitions ==============================
[Anonymous] path = /samba/anonymous browsable =yes writable = yes guest ok = yes read only = no
force user = nobody

Then I'll create a directory for the anonymous share.

mkdir -p /samba/anonymous

Set the correct permissions.

chmod -R 0755 /samba/anonymous/
chown -R nobody:nogroup /samba/anonymous/

And restart Samba to apply the new configuration.

service smbd restart

Now you can access the Ubuntu sharing in Windows by entering "\\server1" in the windows search field of the menu or use the network browser of the Windows file explorer to connect to the share.

Try to upload a file by Drag&Drop to the share to see if it is working correctly.

You can cross check the content at server also.

ls -la /sambe/anonymous/
[email protected]:/# ls -la /samba/anonymous/
total 8228
drwxr-xr-x 2 nobody nogroup 4096 Oct 30 15:14 .
drwxr-xr-x 3 root root 4096 Oct 30 15:07 ..
-rwxr--r-- 1 nobody nogroup 8414449 Jul 14 2009 Kalimba.mp3

3. Secured Samba server

For the password-protected share, I will create a group smbgrp and user till to access the Samba server. I'll use "howtoforge" as password in this example, please choose a custom and secure password on your server.

addgroup smbgrp
useradd till -G smbgrp
smbpasswd -a till
[email protected]:~# smbpasswd -a till
New SMB password:<--howtoforge
Retype new SMB password:<--howtoforge
Added user till.
[email protected]:~#

Now create the folder with the name "secured" in the /samba folder and give permissions like this

mkdir -p /samba/secured
cd /samba
chmod -R 0770 secured
chown root:smbgrp secured

Edit the Samba configuration file and add the following (red) lines at the end of the file:

nano /etc/samba/smb.conf

[secured] path = /samba/secured valid users = @smbgrp guest ok = no writable = yes browsable = yes
service smbd restart 

To cross-check the settings, run this command:

[email protected]:~# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[Anonymous]"
Processing section "[secured]"
Loaded services file OK.
Press enter to see a dump of your service definitions<--ENTER

    netbios name = UBUNTU
    server string = Samba Server %v
    map to guest = Bad User
    dns proxy = No
    idmap config * : backend = tdb

    path = /samba/anonymous
    read only = No
    guest ok = Yes

    path = /samba/secured
    valid users = @smbgrp
    read only = No
[email protected]:~#

At the Windows machine, open the "\\server1" network device again, it will request a username and password now. Enter the user details that you created above. In my case, the values were user=till and password=howtoforge.

We can check the file at the Ubuntu server like this:

ls -la /samba/secured/
[email protected]:~# ls -la /samba/secured/
total 64
drwxrwx--- 2 root smbgrp 4096 Oct 30 15:33 .
drwxr-xr-x 4 root root 4096 Oct 30 15:23 ..
-rwxr--r-- 1 till till 57113 Oct 13 2012 OptimizationReport.htm

Now we have a successfully configured Samba server with an anonymous and a secured share on Ubuntu 15.10 :)

Share this page:

11 Comment(s)

Add comment

Please register in our forum first to comment.


By: Surja

Thank you, this tutorial works perfectly enabling a Windows 7 user to share files with a Ubuntu 14.04 - 15.10 user.

By: JD

On Ubuntu, sudo use is required. Did I miss the sudo -s or sudo -i to gain root?

sudoedit is a safer way to edit config files for a number of reasons, though sudo nano probably isn't dangerous.

Some Win10 systems need a few settings changed for browsing to work:

There should be  a  standard warning about using any non-LTS Ubuntu server.  Is 9 months of support for a server? Usually, "no" is the answer.  Stay LTS, stay supported.

By: Sam

Thank you - seriously...

By: Brian Hoskins

I was not able to get the anonymous share working but the user/password access shares work fine.  I figured that it might be because there were no instructions for creating the user 'nobody'.  I created that user, with no password, but still no luck.  Will have to go off and do some more reading!

By: Stephen Griswold

Thanks for the Tutorial!  I had an old samba server set up until about a year ago, running on an old P4, and I had to dismantle it, and delete the files from it.. Slowly rebuilding a new server where I live now, and using the new UBUNTU 15.10.

By: stphn

I followed your guide to a T. When I go to enter my network credentials on my Windows 10 machine I get "Access is denied." after entering my password. Does anyone know why this is happening?

By: Jobo

I'm having the exact same problem. I tried to set up Samba with a different tutorial, then i deleted the wrong partition. So i started from scratch and installed Ubuntu 15 then went through this tutorial.

By: Jobo

I solved my issue and probably stphn's. I edited the config under [secured] to say valid users = josh instead of valid users = @smbgrp. Then closed and did service smbd restart

and i authenticated with josh's password and then after that i could log in with josh in Windows

By: till

Most likely your user josh was not a member of the group smbgroub then. To add a user "josh" that is part of the smbgrup, use this command:


useradd josh -G smbgrp

By: Sycoss

Thank you, this tutorial is perfect ! :)

By: amarandi

I just want to use it in my private (in home) network, so what should I put instead of "" in windows host list? server1