Map a Samba Network share from Windows

source: https://kb.edgehosting.com/KnowledgebaseArticle53058.aspx

This guide will show you how to map a drive in Windows so you can connect to a Samba share.

First Step: Creating the Samba Users

a. Add the unix accounts on the server

To add the unix accounts, use the following commands:

  • useradd $USER
  • passwd $USER

This will create the user and set the password. Run them individually. First add the user, then set the password.

b. Add the user to Samba database

To add the user you just created to the samba database, you will run the following commands:

  • sampasswd -a $USER

Now edit the samb conf file. On RHEL6 it is located in /etc/samba/smb.conf. Add the following line to the specific Samba share, [example-share], in the conf file:

valid users = $USER1 $USER2 etc...

Now restart the Samba service

service smb restart

Second Step: Map the Share in Windows 7!

Disclaimer: Change these settings at your discretion. These changes DO have a potential impact on the security of your computer.

Before you can proceed to adding the drive mapping, you need to first reconfigure some security policy settings on your local machine which may not apply to everyone; however, it's worth checking out. This will help ensure you can communicate with the unix machine running the Samba share. You may try to add it first before changing the settings, but if it fails this should do the trick.

a. Edit the Security Policy Settings

shortcut!

start - run - secpol.msc - enter

or do this if you don't want to use the run command:

Start - Control Panel - Administrative Tools Open Local Security Policies ..and here's what you do once the security policies screen is up:

  • Expand Local Policies
  • Open Security Options
  • Open Network security: LAN Manager Authentication Level
  • Set the drop-down to 'Send LM & NTLM (use NTLMv2 if negotiated)'
  • Click apply and ok
  • Open Network Security: Minimum session security for NTLM SSP
  • Uncheck 'Require 128-bit encryption'
  • Apply and OK
  • Do the same for the other NTLM SSP Security directly underneath the first

b. Map the Drive!

shortcut!

start - Run - CMD - enter

net use x: \\address\share_name /u:$USER

Note: The variable name $USER can also be substituted with an actual username for the target computer. And in fact that may work better.

When you hit enter after that, it will prompt for the users password. Just put it in. Also the 'x:' can be replaced with whatever drive letter you want to use.

long version

  • Open 'My Computer' (or just “Computer” from your start menu)
  • Click Map network drive
  • Set the drive letter
  • Enter the Folder Name (Samba share address)\\address\share_name
  • Your choice for reconnect at logon. I'm assuming you won't want to do this every time, so just leave that checked.
  • Press finish and enter your user information as requested.

Your drive is mapped.

Disconnect a Mapped Drive

To disconnect a mapped drive using the command line:

  • Click Start, and then click Run.
  • In the Open box, type cmd.
  • Type net use x: /delete, where x: is the drive letter of the shared resource.
Last modified:: 2016/03/19 16:03