Ubuntu - How to Install and Setup Samba File Sharing

Install Samba

sudo apt-get install samba smbfs

Then edit the config file

sudo nano /etc/samba/smb.conf

Find the Authentication section which is marked with a header of

'####### Authentication #######' and make the following changes.

Uncomment the security line and add a line

security = user
username map = /etc/samba/smbusers

Now let's add a Samba user by running this command:

# sudo smbpasswd -a <username>

it will then ask you to set a password and confirm

next we will create the file we referenced above and add this

user we just added.

# sudo gedit /etc/samba/smbusers

Add the ubuntu username which you want mapped to the current user

you just added to samba.

Something like this:

<ubuntu-username> = "<samba username>"

save file and exit

Now setup which folders to share

# sudo nano /etc/samba/smb.conf

Find the Share definition section by looking for this

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

======================="


You will want to uncomment and edit these lines:

[homes]
comment = Home Directories
browseable = yes

Uncomment and edit this line:
read only = no

uncomment this line:
valid users = %S

uncomment this line:
writable = yes

Now restart samba

# sudo /etc/init.d/samba restart

You are all set, now connect to this share folder from windows by

accessing \\ipaddress-of-ubuntu\username

You will be prompted to enter your username and password and then

you will have access to your home folder.