summaryrefslogtreecommitdiff
path: root/doc/note/samba/samba.txt
blob: 92c89fdeb94187d545b0ef6f957bb98d5bf67214 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

Samba (aka SMB, ServerMessageBlock)
===================================


  && $SUDO apt install --no-install-recommends samba


## List smb shares on a remote

  $SUDO apt install --no-install-recommends smbclient
  smbclient -NL //10.0.2.2


## Mount a share

Variant for "/etc/fstab" (make sure mount dir exists):

//10.0.2.2/sharename  /mnt/sharename  cifs  password=,uid=1000,gid=1000,user,vers=3.0  0  0


## Fix silly resolve issues (smb.conf)

[global]
    name resolve order = host lmhosts wins bcast


## Base config for "/etc/samba/smb.conf"

[global]
    workgroup = WORKGROUP
    interfaces = 127.0.0.0/8
    bind interfaces only = yes
    log file = /var/log/samba/log.%m
    max log size = 1000
    logging = file
    panic action = /usr/share/samba/panic-action %d
    server role = standalone server
    obey pam restrictions = yes
    unix password sync = yes
    passwd program = /usr/bin/passwd %u
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    pam password change = yes
    map to guest = bad user
    usershare allow guests = yes


## Example shares (for "/etc/samba/smb.conf")

[net-visible-share-name]
    path = /server/path/to/be/shared
    public = no     # <- TODO explain
    writeable = yes   # TODO explain
    guest ok = yes
    force user = allClientsWillLookLikeThisUsername
    #create mask = 0640
    #directory mask = 0770



## Refs

[smb hostname resolve bug](https://serverfault.com/a/609377/673216)