Samba: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
No edit summary
Line 1: Line 1:
= Description =
This page will show you how to create Windows shares on a Linux box.  This will allow Windows computers to access files on Linux.<br>
= Installation =
= Installation =
Firstly install the samba server
The following will allow a Windows computer to connect to the Samba shares as anonymous without authentication.


== Installation of Applications ==
<pre>
<pre>
yum install samba
yum install samba
</pre>
</pre>


== Configuration of Applications ==
<pre>
Once the required applicatons are installed we can add the computer to the domain by running authconfig.
systemctl enable smb
</pre>


= Configuration =
== Globals ==
<pre>
<pre>
authconfig-tui
vi /etc/samba/smb.conf
</pre>
</pre>


Under the User infromation select <strong>Use Winbind</strong><br>
<pre>
Under Authentication select <strong>Use Winbind Authentication</strong><br>
        workgroup = WORKGROUP
Under the Authentication column the "Use MD5 Password" and "Use Shadow Passwords" should be automatically select.  Leave them selected.
        server string = My Media Server


[[image:auth-config.jpg]]
        netbios name = centos
</pre>


Security Model is ads<br>
<pre>
Domain is NETBIOS domain name<br>
        security = user
Domain Controllers is the name of a Domain Controller<br>
        passdb backend = tdbsam
ADS Realm is DNS (FQDN) domain name <br>
        map to guest = bad user
by default the /bin/false is selected.<br>
</pre>


[[image:winbind.jpg]]
<pre>
        load printers = no
</pre>


Select Join Domain.<br>
== File Shares ==
Select Ok.<br>
<pre>
[alpha]
  path = /mnt/usb-hd0/alpha
  comment = Alpha File Share
  public = yes
  browseable = yes
  writable = yes
  guest ok = yes
  read only = no
 
[beta]
  path = /mnt/usb-hd0/beta
  comment = Beta File Share
  public = yes
  browseable = yes
  writable = yes
  guest ok = yes
  read only = no
</pre>
 
 
== File Permissions ==
As with a Windows computer there are two aspects to file sharing.  The share permission and the file permission.<br><br>
 
File Permissions


== Creating File Shares ==
Now edit the file /etc/samba/smb.conf file.<br>
Create the required shares.
<pre>
<pre>
[meetme]
chmod -R 757 /path/to/folder
  comment = comment here
  path = /var/spool/asterisk/meetme
  guest ok = no
  browseable = yes
  writable = yes
  valid users = @"DOMAIN\Group Name"
  valid users = DOMAIN\username
</pre>
</pre>


Once the file has been saved restart the service.
Set Folder Owner to nobody
<pre>
<pre>
service smb restart
chmod -R nobody:nobody /path/to/folder
</pre>
</pre>


== Auto start Service ==
= Services =
Set the servcie to auto start by issuing the following command.
Once the file has been saved restart the service.
<pre>
<pre>
chkconfig smb on
systemctl restart smb
</pre>
</pre>


== Connecting to Windows UNC ==
 
= Connecting to Windows UNC =
If you require to mount to a UNC then you will also need to install the samba-client.
If you require to mount to a UNC then you will also need to install the samba-client.
<pre>
<pre>

Revision as of 05:30, 20 June 2015

Installation

The following will allow a Windows computer to connect to the Samba shares as anonymous without authentication.

yum install samba
systemctl enable smb

Configuration

Globals

vi /etc/samba/smb.conf
        workgroup = WORKGROUP
        server string = My Media Server

        netbios name = centos
        security = user
        passdb backend = tdbsam
        map to guest = bad user
        load printers = no

File Shares

[alpha]
  path = /mnt/usb-hd0/alpha
  comment = Alpha File Share
  public = yes
  browseable = yes
  writable = yes
  guest ok = yes
  read only = no

[beta]
  path = /mnt/usb-hd0/beta
  comment = Beta File Share
  public = yes
  browseable = yes
  writable = yes
  guest ok = yes
  read only = no


File Permissions

As with a Windows computer there are two aspects to file sharing. The share permission and the file permission.

File Permissions

chmod -R 757 /path/to/folder

Set Folder Owner to nobody

chmod -R nobody:nobody /path/to/folder

Services

Once the file has been saved restart the service.

systemctl restart smb


Connecting to Windows UNC

If you require to mount to a UNC then you will also need to install the samba-client.

yum -y install samba-client cifs-utils

If you do not have the samba client installed you will get errors like:

CIFS VFS: cifs_mount failed w/return code = -22