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

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


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!!)
Thanx, this guide was useful for me, it works perfectly..!!
i needed to transfer music and movies from my home pc to my carpc and this worked like a charm. thanks!
nice guide how-to-geek! does exactly what is says on the tin.
Great post. Well put together. The only thing I might append, is how to share another directory like /var/www in the smb.conf.
Thx alot, been fidling with these for awhile know.
Thx again.
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?
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
Thanks! I was trying to figure that one out. Keep up the excellent work!
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
how do i know the name of my computer?
“Thats it you can access this maching from windows using
//linuxserver-IP/wsuser”
Whats the linuxserver-IP?
# 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
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
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)
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.
hello
but how do i access windows from linux
Use:
smbclient //windows-machine/sharefolder
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.
how can i share folders that are not in my home directory???
Got me up and running. Now I can use the server while I learn about the other parameters. Thanks!!!!
You may want to check this carefully. On some distros, this setting allows the entire directory structure to be browsed……
Thanks the best and simplest tutorial I’ve ever seen.