How-To Geek

Share Ubuntu Home Directories using Samba

Samba Server allows you to share the home directories of users automatically. This can be useful so that you don’t have to manually create every share for every user.

First, make sure that you’ve installed Samba server.

To share the home directories, open up smb.conf with the following command:

sudo gedit /etc/samba/smb.conf

Find this section of the file, and make it match the following:

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user’s home directory as \\server\username
comment = Home Directories
browseable = yes

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only “username” can connect to \\server\username
valid users = %S

# By default, the home directories are exported read-only. Change next
# parameter to ‘yes’ if you want to be able to write to them.
writable = yes

Now you should be able to map a drive on windows using the following share format:


For example, if the Ubuntu machine is named ubuntuserv, and the username is geek, your share path would be \\ubuntuserv\geek

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 01/7/07

Comments (33)

  1. Michael Gunter

    thanks, a roommate got a nasty bug on his Win-XP box. I created a user account for him on my linux box so he could do a backup of several GB of files/fresh XP install.

    (my daughter would not lend us her iPod to use as a HDD backup. Kids these days!!)


  2. o5k4r.m4dr1d

    Thanx, this guide was useful for me, it works perfectly..!!

  3. kacole2

    i needed to transfer music and movies from my home pc to my carpc and this worked like a charm. thanks!

  4. aadvark

    nice guide how-to-geek! does exactly what is says on the tin.

  5. Beorn

    Great post. Well put together. The only thing I might append, is how to share another directory like /var/www in the smb.conf.

  6. Daniel

    Thx alot, been fidling with these for awhile know.
    Thx again.

  7. K

    Is there a way to give an admin access to multiple [homes] shares AND to ensure any files that the admin creates in the [homes] shares have their permissions set to the user who owns that home directory?

  8. Kaithy Aravind Reddy

    Thanks a lot. It works well, simple and effective,I did it on Ubuntu 8.04.
    my steps that worked for me.

    1) create unix user (e.g. wsuser)
    2) sudo apt-get install samba smbfs
    3) sudo smbpasswd -a wsuser
    4) sudo gedit /etc/samba/smbusers
    #add this line
    wsuser = “wsuser”
    5) sudo gedit /etc/samba/smb.conf
    # add two lines after “####### Authentication #######”
    security = user
    username map = /etc/samba/smbusers

    # Uncomment below three lines
    comment = Home Directories
    browseable = yes
    # add line
    writable = yes

    Thats it you can access this maching from windows using

  9. Lee Underwood

    Thanks! I was trying to figure that one out. Keep up the excellent work!

  10. diverge

    Great work !!!
    I have installed and configured Samba following the steps in this tutorial and tested on my private network and everything worked just fine.
    Best wishes

  11. blong

    how do i know the name of my computer?

  12. blong

    “Thats it you can access this maching from windows using

    Whats the linuxserver-IP?

  13. Tim

    # By default, the home directories are exported read-only. Change the
    # next parameter to ‘no’ if you want to be able to write to them.
    read only = no

  14. Cemao

    Thanks for this tutorial…
    I had a strange problem. I just wanted to share a removable disk. It works perfectly when the [homes] section in smb.conf is enabled, but does not work when i comment it out.

    Has anybody an idea how I can disable home sharing?


  15. new fish

    thank you. now I can share files on my desktop (Linux) with my laptop(WInXP)
    but how do I share files in other location? (not only in home directory)

  16. Chuck

    Under the section:

    comment = Home Directories
    browseable = yes

    add something like:

    path = /shared/MyFolder
    browseable = yes

    where /shared/MyFolder is a folder on your machine. You can also browse to any folder, right-click on it and select “share folder”. Then set “share through” to Windows Networks (SMB), set the name, comments & “read-only” flag. The entry will be created for you in the smb.conf file.

  17. santiago

    but how do i access windows from linux

  18. Ulfang


    smbclient //windows-machine/sharefolder

  19. Kim SJ

    Took me a while to notice that the “[homes]” line is commented out as well as the lines in that section. Maybe others will fall into that trap too… hope this helps. :-)

  20. Nishu

    how can i share folders that are not in my home directory???

  21. mrzero

    Got me up and running. Now I can use the server while I learn about the other parameters. Thanks!!!!

  22. cnemelka

    You may want to check this carefully. On some distros, this setting allows the entire directory structure to be browsed……

  23. Khaled

    Thanks the best and simplest tutorial I’ve ever seen.

  24. rupali

    Hi sir,

    i m trying to configure samba. smb.conf i changes as follows
    workgroup = R&D
    wins support = yes
    security = user
    username map = /etc/samba/smbuser

    /after that i create one directory as test
    path = /share/test
    available = yes
    browseable = yes
    public = yes
    writable = yes
    guest ok = no

    after that much configuration i restart the samba.
    but it will give me error as

    \\linuxserver-ip\test is not accessible. You might not have permissions to use this network resource. Contact the administrator of this server to find out if you have access permissions.

    i change the permission of test directory as 774.
    Thanks in advance.

  25. sis

    Remove the ‘/’ from /[test]

  26. yash

    I am able to see the share folder, when tried clicking/ accessing, windows PC is prompting for username and pwd. I tried enterting both the pwds ubuntu and password created by smbpasswd command, its not accepting.

    Please do let me know.


  27. Nigel C

    Great job – this worked first class for me, I am on Ubuntu 10.04 and have a small domain set up at home with Windows2003 server

    Thank for posting this.

  28. randy

    thank you works ;-)

  29. keesp

    I tried to get everything working on Ubuntu 10 by using the GUI

    1: start nautilus: gksudo nautilus
    2: browse to the location for your share folder: e.g. /home/share
    3: create this folder if necessary
    4: right-click mouse and select ‘sharing options’
    5: fill in the necessary details and press ok

    Ubuntu installed samb at this point and set the correct user options

    6: Set the permissions depending on the requirements (right-clcik mouse -. properties)

    Worked perfectly and by-passed a lot of manual editing

  30. r0bin

    works great for me on my ubuntu 10.0
    clear and efficient explanations, good job thanks :-)

  31. Melroy van den Berg

    Thanks! I needed the:
    writable = yes

    I didn’t know it was by default on no :)

  32. Ajay

    can any tell me how to access linux dir to MAC system in Linux. and MAC user can access only ip address and there are going to own dir not other.

  33. Laurie

    All the above is good and well but…
    I have installed a 2 disk system and want to share the second drive with folders for multiple departments.
    Problem is that they will not allow any access from Windows machines.
    So is it possible to share folders on a second drive as I simply do not want the shared area on the system drive?

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!