Samba4 Installation simple: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
 
(3 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 3: Zeile 3:
  
 
=Konfiguration=
 
=Konfiguration=
 +
==Basic==
 +
<pre>
 +
[global]
 +
  workgroup = WORKGROUP
 +
  server string = %h server (Samba, Ubuntu)
 +
  dns proxy = no
 +
  log file = /var/log/samba/log.%m
 +
  max log size = 1000
 +
  panic action = /usr/share/samba/panic-action %d
 +
  server role = standalone server
 +
  passdb backend = tdbsam
 +
  unix password sync = yes
 +
  pam password change = yes
 +
  passwd program = /usr/bin/passwd %u
 +
  passwd chat = *new*password* %n\n *new*password* %n\n *updated*
 +
  passwd chat debug = yes
 +
  map to guest = bad user
 +
  usershare allow guests = yes
 +
  acl allow execute always = yes
 +
</pre>
 
==User anlegen==
 
==User anlegen==
 
Um einen samba user anzulegen wird ein user auf dem system benötigt (useradd). Anschließend muss dem gewünschtem user ein samba passwort gegeben werden
 
Um einen samba user anzulegen wird ein user auf dem system benötigt (useradd). Anschließend muss dem gewünschtem user ein samba passwort gegeben werden
Zeile 22: Zeile 42:
  
 
==public share==
 
==public share==
*mkdir /var/samba
+
*mkdir /mnt/share
*chmod 777 /var/samba/
+
*chmod 777 /mnt/share
  
 
unter
 
unter
Zeile 30: Zeile 50:
  
 
<pre>
 
<pre>
[public]
+
[share]
 
   comment = public anonymous access
 
   comment = public anonymous access
   path = /var/samba/
+
   path = /mnt/share/
 
   browsable =yes
 
   browsable =yes
 
   create mask = 0660
 
   create mask = 0660
Zeile 44: Zeile 64:
 
In der smb.conf sollten folgende Einträge stehen:
 
In der smb.conf sollten folgende Einträge stehen:
 
<pre>
 
<pre>
  unix password sync = yes
+
unix password sync = yes
  pam password change = yes
+
pam password change = yes
  passwd program = /usr/bin/passwd %u
+
passwd program = /usr/bin/passwd %u
  passwd chat = *new*password* %n\n *new*password* %n\n *updated*
+
passwd chat = *new*password* %n\n *new*password* %n\n *updated*
 
</pre>
 
</pre>
  
Zeile 58: Zeile 78:
 
echo -e "$password\n$password" | /usr/bin/smbpasswd -s -a $username
 
echo -e "$password\n$password" | /usr/bin/smbpasswd -s -a $username
 
</pre>
 
</pre>
 +
*password <username> <neues passwort>

Aktuelle Version vom 12. November 2018, 11:34 Uhr

Installation

  • apt-get install samba

Konfiguration

Basic

[global]
   workgroup = WORKGROUP
   server string = %h server (Samba, Ubuntu)
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   passdb backend = tdbsam
   unix password sync = yes
   pam password change = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *new*password* %n\n *new*password* %n\n *updated*
   passwd chat debug = yes
   map to guest = bad user
   usershare allow guests = yes
   acl allow execute always = yes

User anlegen

Um einen samba user anzulegen wird ein user auf dem system benötigt (useradd). Anschließend muss dem gewünschtem user ein samba passwort gegeben werden

  • smbpasswd -a username

privat share

Unter

  • vi /etc/samba/smb.conf

folgende Zeilen einfügen:

[homes]
   comment = Home Directories
   browseable = yes
   read only = no
   create mask = 0700
   directory mask = 0700
   valid users = %S

public share

  • mkdir /mnt/share
  • chmod 777 /mnt/share

unter

  • vi /etc/samba/smb.conf

folgende Zeilen einfügen:

[share]
  comment = public anonymous access
  path = /mnt/share/
  browsable =yes
  create mask = 0660
  directory mask = 0771
  writable = yes
  guest ok = yes

password sync zwischen unix und samba

In der smb.conf sollten folgende Einträge stehen:

unix password sync = yes
pam password change = yes
passwd program = /usr/bin/passwd %u
passwd chat = *new*password* %n\n *new*password* %n\n *updated*

Passwort sync als root geht so nicht. Dafür folgendes script:

#!/bin/bash
username=$1
password=$2
echo $username:$password | chpasswd
echo -e "$password\n$password" | /usr/bin/smbpasswd -s -a $username
  • password <username> <neues passwort>