Tutorial: Share Ubuntu folder with Windows

I’ve had several problems getting a Ubuntu folder show up as a shared folder on my Windows machine. They were:

  • Ubuntu machine does not show up in Windows > Network. Nor can I get to it with \\UBUNTUMACHINE
  • When it does show up, there are no shared folders visible
  • When they’re visible, the share complains of Access Denied
  • Files created in Windows and then placed in the shared folder, result in the file in Ubuntu created by a “nobody” user and I cannot modify it on Ubuntu

The following steps address all the above problems:

Install samba package: 

sudo apt-get install samba

Create a samba user:

sudo smbpasswd -a your_ubuntu_username_here

Use the username you use to login to your Ubuntu machine. Set the password as desired. Windows will ask for this username + password combination to gain access to the shared folder.

Create the folder you want to share:

mkdir /home/username/UbuntuShare

If you already had created one, ensure you’re its owner:

sudo chown username /home/username/UbuntuShare

Create a samba share in the config file (from here):

sudo gedit /etc/samba/smb.conf

At the end of the file, paste the following:

[UbuntuShare]
 path = /home/USERNAME/UbuntuShare
 available = yes
 valid users = USERNAME
 read only = no
 browsable = yes
 public = yes
 writable = yes

Change the section name [UbuntuShare] to the name of the share you want to see.

Configure samba to be visible to Windows (from here):

Near the top of the smb.conf file, find the [global] section and paste the following:

[global]
 workgroup = YOUR_WORKGROUP
 netbios name = UBUNTU_MACHINE_NAME
 lanman auth = no
 ntlm auth = yes
 client lanman auth = no
 wins support = yes
 local master = yes
 preferred master = yes

Change YOUR_WORKGROUP to match the workgroup of your Windows machine and change UBUNTU_MACHINE_NAME to the name you want to see in Windows > Network.

Save the conf file and restart samba:

sudo service smbd restart

Now the Ubuntu machine should be visible in Windows > Network. Accessible by its \\NAME. The share should be visible. You should be able to access it with the username and password used above. You should also be able to edit files in Ubuntu that were created in the share from Windows, and vice versa.