SAMBA on RHEL Mounted to Windows

What Samba

Samba allows file and print sharing between computers running Windows and computers running Unix. It is an implementation of dozens of services and a dozen protocols, including: NetBIOS over TCP/IP (NBT) SMB.

Steps to setup Samba Share

Step 1. Install Samba on server

use Yum (new version dnf) i.e.:         sudo yum install samba samba-client samba-common

Step 2. Setup Samba user & vi samba config file

Samba gets installed in /etc/samba. Before I make change to any config file I make a backup of the config file.

  cp /etc/samba/smb.conf  /etc/samba/smb.conf_Original        or

                                                                                          cp /etc/samba/smb.conf  ~/smb.conf_Original

I do the same for smbusers – make a backup.

Next edit the “vi /etc/samba/smb.conf”. Two section I amend for a basic share. you can play to your harts content with all the settings adding or hashing out.

Find Network Related options add your work group in and your Netbios name

# ———————– Network Related Options ————————-
#
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
#
# server string is the equivalent of the NT Description field
#
# netbios name can be used to specify a server name not tied to the hostname
#
# Interfaces lets you configure Samba to use multiple interfaces
# If you have multiple network interfaces then you can list the ones
# you want to listen on (never omit localhost)
#
# Hosts Allow/Hosts Deny lets you restrict who can connect, and you can
# specifiy it as a per share option as well
#
                workgroup = MYGROUP
                server string = Samba Server Version %v

;               netbios name = MYSERVER

;               interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
;               hosts allow = 127. 192.168.12. 192.168.13.

The next bit, I edit for a basic share config, I locate Share Definitions. This is where you define the path, user account that has access to this share, if it is write and browsable and so on.

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

[homes]
              comment = Home Directories
              browseable = no
              writable = yes
;             valid users = %S
;             valid users = MYDOMAIN\%S

[printers]
                comment = All Printers
                path = /var/spool/samba
                browseable = no
                guest ok = no
                writable = no
                printable = yes

There a more in the file. If you want to check before editing just cat the file.

Once this is done you have to setup the samba user you added to the config file above, this include password. This is important as when the user try and access the fine. This not much different than setting up a user in Linux

 # smbpasswd -a username

Now the most important part remember to start the Samba services

#  service smb start

More info around this can be found in man pages. Now you should be ready to mount the share to Windows

 

Step 3.  Mount on Windows Server/Desktop

In Windows 2003  to 2012 you can use either of the following commands. When your run the mount into Windows your will be prompted for the user name and password that you have setup in Samba.

via cmd:                                                           net use M: \\servername\Share /Persistent:Yes

via Powershell:                                             New-PSDrive –Name “K” –PSProvider FileSystem –Root “\\servername\share” –Persist

It worked fine for me. You might have to tweak the config file more to your needs.

Cheers.

Comments

comments

Privacy Preference Center