Samba: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Firstly install the samba server and client
= Installation =
The following will allow a Windows computer to connect to the Samba shares as anonymous without authentication.


<pre>
<pre>
yum install samba samba-client
yum install samba
</pre>
</pre>


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


= Configuration =
== Globals ==
<pre>
<pre>
authconfig
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
 
<pre>
chmod -R 757 /path/to/folder
</pre>
 
Set Folder Owner to nobody
<pre>
chown -R nobody:nobody /path/to/folder
</pre>
 
Set defaults for new files
<pre>
setfacl -d -m g::rwx /path/to/folder
</pre>
 
= Services =
Once the /etc/samba/smb.conf file has been completed and saved restart the service.
<pre>
systemctl restart smb
</pre>
 
= Connecting to Windows UNC =
 
== Installation ==
<pre>
yum -y install samba-client cifs-utils
</pre>
 
== Mounting ==
<pre>
mount -t cifs -o workgroup=workgroup,username=myuser,password=mypassword //my.server.name/sharename /tmp/smbmountpoint
</pre>
 
If you do not have the samba client installed you will get errors like:
<pre>
CIFS VFS: cifs_mount failed w/return code = -22
</pre>


Now edit the file /etc/samba/smb.conf file.<br>
= Tools =
Create the required shares.
Viewing Default Folder Permissions
<pre>
<pre>
[meetme]
getfacl /folder/to/view
  comment = comment here
  path = /var/spool/asterisk/meetme
  guest ok = no
  browseable = yes
  writable = yes
</pre>
</pre>


Once the file has been saved restart the service.
Setting Default Permissions
<pre>
<pre>
service restart smb
setfacl -d -m o::rwx /folder/to/set
</pre>
</pre>


[[Category: Authentication]] [[Category: Shares]]
[[Category: Linux]]

Latest revision as of 06:43, 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

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

Set defaults for new files

setfacl -d -m g::rwx /path/to/folder

Services

Once the /etc/samba/smb.conf file has been completed and saved restart the service.

systemctl restart smb

Connecting to Windows UNC

Installation

yum -y install samba-client cifs-utils

Mounting

mount -t cifs -o workgroup=workgroup,username=myuser,password=mypassword //my.server.name/sharename /tmp/smbmountpoint

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

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

Tools

Viewing Default Folder Permissions

getfacl /folder/to/view

Setting Default Permissions

setfacl -d -m o::rwx /folder/to/set