Share Ubuntu Directories With WIndows Using Samba

Share Ubuntu Directories With WIndows Using Samba

This article summerises the steps I did while learning setting up the samba server in my home network. And these steps are based on the Ubuntu server setup. Firstly you need to install samba server, open a terminal and type in the following command:
[email protected]:# sudo apt-get install samba smbfs
Wait till it finishes installation, then open the samba configuration file :
[email protected]:# sudo vim /etc/samba/smb.conf
Find this section in the file:
####### Authentication #######

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba-HOWTO-Collection/ServerType.html
# in the samba-doc package for details.
;  security = user
Uncomment the security line, and add another line to make it look like this:
security = user
username map = /etc/samba/smbusers
This will set Samba to use the smbusers file for looking up the user list. Next we need to find the section below in the conf file and make it match with 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
This section allows Windows users to access Ubuntu user home directory. Now it is time to create a samba user
[email protected]:# sudo smbpasswd -a
Enter the password upon request, next we’ll add that username to the smbusers file.
[email protected]:# sudo vim /etc/samba/smbusers
Add in the following line into the user file:
 = ""
Now try to access your ubuntu user directory by typing \\\\\\ at the address bar in the explorer, enter the username and password upon request, you should be able to see the files. Problem encountered: I can only setup one samba user to access from Windows machine, when I try to create a new user using the smbpasswd command, it always failed, more investigation is needed.

Leave a Reply

Your email address will not be published. Required fields are marked *

My new Snowflake Blog is now live. I will not be updating this blog anymore but will continue with new contents in the Snowflake world!