I had some problems with connecting my Windows 10 computer to my Ubuntu 16.04.1's samba server. Finally I got it.

So how to share files on the Ubuntu 16 server with Windows 10 computers?


First, if you made any changes to an existing samba configuration, revert them, or delete the /etc/samba/smb.con and uninstall samba.

I assume your Ubuntu server username is peterlustig and the Ubuntu server IP is

  1. sudo apt-get install samba
  2. sudo cp -pf /etc/samba/smb.conf /etc/samba/smb.conf.bak Just backup your config
  3. sudo mkdir /myshares- what you want to share via Samba
  4. sudo chown peterlustig:peterlustig /myshares
  5. sudo chmod 777 /myshares or experiment with lower rights, I havn't done that yet
  6. sudo smbpasswd -a peterlustig Adds the user peterlustig to the Samba database and activates it. (Usually different password than peterlustig in Ubuntu itself. The password is what you need to enter later when connecting with the Windows 10 client to the server, step 10)
  7. sudo nano /etc/samba/smb.conf And add the following to the bottom of the file:

    # Samba share for Windows clients
    path = /myshares
    available = yes
    valid users = peterlustig
    read only = no
    browseable = yes
    public = yes
    writable = yes
  8. sudo /etc/init.d/samba restart restart your server and reload the config

  9. If you use the ufw Firewall, you need to configure it. E.g. I allow only 192.xxx.xxx.xxx hosts to access my Samba shares, so I entered: sudo ufw allow from to any app Samba
  10. In the Windows 10 client, open a Windows Explorer and enter the IP address of your host: \\ Now you should see your shared folder named my-shared-folder-name from step 8 in the [] brackets. Open it. Now you need to enter your credentials, i.e. username peterlustig and the password you entered in step 6.

You can even map it as Windows network drive. Address will be \\\my-shared-folder-name, and don't forget to enable using different credentials (than your Windows 10 user provides) and enter peterlustig and password from step 6 there.

Hope this helped anyone. Happy sharing!

  • Consider making this community wiki. – user595510 Feb 16 '17 at 14:33
  • @MarkYisri why? – Zanna Mar 5 '17 at 11:16
  • @Zanna it is helpful information that can be used (and edited) by anyone. Community wiki encourages that – user595510 Mar 8 '17 at 23:59
  • Step 8 should be sudo systemctl restart smbd – cstrutton Apr 30 '17 at 15:17
  • 1
    Shouldn't step 8 be sudo service smbd restart ? – mcbarron Mar 25 '18 at 1:13

Restart Ubuntu after fresh installation and add user

$ sudo smbpasswd -a username (username should be without space eg "sudo smbpasswd -a alamjitsingh")
New SMB password:*********
Retype new SMB password:*********
Added user alamjitsingh.

smb.conf required settings

sudo -H gedit /usr/share/samba/smb.conf

 workgroup = WORKGROUP
 passdb backend = tdbsam 
 security = user 

In authentication section turn "map to guest = bad user" off by adding # at starting of code (Must)

#map to guest = bad user

You can try adding this line if it's not working (replace with your username):

force user = alamjitsingh

Add your personal code at the end

path = /media/alamjitsingh/Shared_drive_Name (alamjitsingh is my ubuntu username)
comment = HD Share
read only = yes
available = yes
browseable = yes
writable = no
guest ok = no
public = yes
printable = no
locking = no
strict locking = no
  • With this method I can access my shared drive on win10. – Alamjit Singh Mar 5 '17 at 11:07
  • after fresh installation, start reading from Restart Ubuntu....... – Alamjit Singh Mar 5 '17 at 11:11
  • 1
    In windows 10 you have to "Add a Network Location" manually, eg "\\\ Shared_drive_Name" then it will ask for username and password. Find this option->Add a Network Location in windows 10. In android devices you can access this shared drive via "ES file explorer" app. – Alamjit Singh Mar 5 '17 at 12:40
  • That was the one thing I missed when connecting to my newly-minted share in my Ubuntu live session. I kept double-clicking the share without success, and then finally tried “Map Network Drive.” I can’t believe that actually worked! – Kevin Li Jun 17 '17 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.