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
Got Feedback? Join the discussion at discuss.howtogeek.com
Comments (33)
Programmer by day, geek by night, The Geek, also known as Lowell Heddings, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.
- Published 01/7/07




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.
Hi sir,
i m trying to configure samba. smb.conf i changes as follows
[global]
workgroup = R&D
wins support = yes
security = user
username map = /etc/samba/smbuser
/after that i create one directory as test
/[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.
Remove the ‘/’ from /[test]
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.
Thanks.
Yash
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.
thank you works ;-)
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
works great for me on my ubuntu 10.0
clear and efficient explanations, good job thanks :-)
Thanks! I needed the:
writable = yes
I didn’t know it was by default on no :)
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.
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?