Subscribe to 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
[homes]
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:

\\ubuntumachine\username

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

The Geek is the founder of How-To Geek and a geek enthusiast. This article was written on 01/7/07 and tagged with: Ubuntu

Daily Email Updates

You can get our how-to articles in your inbox each day for free. Just enter your name and email below:


Name:
Email:
Similar Articles Featured Wiki Articles
Latest Software Reviews Quick Linux Tips
Geek Arcade Popular Forum Threads

Comments (20)

  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
    [homes]
    comment = Home Directories
    browseable = yes
    # add line
    writable = yes

    ————————————————–
    Thats it you can access this maching from windows using
    //linuxserver-IP/wsuser

  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
    //linuxserver-IP/wsuser”

    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?

    Thanks

  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:

    [homes]
    comment = Home Directories
    browseable = yes

    add something like:

    [MyShare]
    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

    hello
    but how do i access windows from linux

  18. Ulfang

    Use:

    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???


Leave a Comment




Leave your friendly comment here.

If you have a computer help question, click here to leave it on the forums instead.

Note: Your comment may not show up immediately on the site.

Sponsored Links
Getting Started
About How-To Geek
What Is That Process?
svchost.exe
jusched.exe
dwm.exe
ctfmon.exe
wmpnetwk.exe
wmpnscfg.exe
rundll32.exe
wfcrun32.exe
Ipoint.exe
Itype.exe
Wfica32.exe
Mobsync.exe
Cmd.exe
Dpupdchk.exe Adobe_Updater.exe

Copyright © 2006-2009 HowToGeek.com. All Rights Reserved.