Jump to content

Help configuring Samba


freezr
 Share

Go to solution Solved by freezr,

Recommended Posts

Ok folks...

 

This very setup was fixed and made working at my job. I tested from the new M$ Terminal while connected to the LAN of my office, extremely satisfied I returned to home and when I connected the HC4 to my router, the "systemd smbd.service" didn't work again (event though at my workplace I rebooted for testing purpose the board several time and Samba had been woking all the time).

 

The Office LAN is most likely managed by a Win Server and is on 192.160.0.X, at home I am connected to a Comcast Cable Router on 10.0.0.X...

 

This the error I get from systemd:

 

× smbd.service - Samba SMB Daemon
Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-06-08 20:48:33 EDT; 19min ago
  Docs: man:smbd(8)
        man:samba(7)
        man:smb.conf(5)
Process: 3650 ExecStartPre=/usr/share/samba/update-apparmor-samba-profile (code=exited, status=0/SUCCESS)
Process: 3655 ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS (code=exited, status=1/FAILURE)
Main PID: 3655 (code=exited, status=1/FAILURE)
Status: "daemon failed to start: reinit_after_fork() failed"
Error: 2 (No such file or directory)
  CPU: 306ms


systemd[1]: Starting Samba SMB Daemon...
smbd[3655]: [2022/06/08 20:48:33.962189,  0] ../../source3/lib/util.c:482(reinit_after_fork)
smbd[3655]:   messaging_reinit() failed: NT_STATUS_OBJECT_NAME_NOT_FOUND
smbd[3655]: [2022/06/08 20:48:33.962547,  0] ../../lib/util/become_daemon.c:119(exit_daemon)
smbd[3655]:   exit_daemon: daemon failed to start: reinit_after_fork() failed, error code 2
systemd[1]: smbd.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: smbd.service: Failed with result 'exit-code'.
odroidhc4 systemd[1]: Failed to start Samba SMB Daemon

 


My setup doesn't change the default "smbd.conf' but it recalls another configuration with:

 

config file = /etc/samba/smb-local.conf

 

I added that line to the very first section of the default "smbd.conf":

 

[global]

config file = /etc/samba/smb-local.conf

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP

# server string is the equivalent of the NT Description field
   server string = %h server (Samba, Ubuntu)

 

All my main configurations go under the "smb-local.conf", this is the setup has been taken from my current "OMSC/RPI2" Samba configuration:

 

[global]

# If you require a fully custom smb.conf create smb-local.conf instead of editing smb.conf so your
# configuration will not be overwritten by samba upgrades. You can use smb.conf as a template by
# copying it to smb-local.conf then removing the config file line below in the new file. If you only
# need to add some additional shares see smb-shares.conf below for a simpler way to do this.


    workgroup = YOUR-HOME-CLOUD
    security=user
    follow symlinks = yes
    wide links = no
    unix extensions = no
    lock directory = /var/cache/samba
    load printers = no
    printing = bsd
    printcap name = /dev/null
    disable spoolss = yes
    log level = 1
    map to guest = bad user
    usershare template share = automount template


##############


    read raw = Yes
    write raw = Yes
    strict locking = no
    min receivefile size = 16384
    use sendfile = true
    aio read size = 2048
    aio write size = 2048
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072


##  FreeBSD Changes


    ntlm auth = yes
    server max protocol = SMB3_11
    server min protocol = NT1
    client max protocol = SMB3_11
    client min protocol = NT1


[droid]
    browsable = no
    read only = yes
    valid users = droid
    path = /home/YOUR-HC4-USER
    comment = Droid Home Directory


[automount template]
    browseable = yes
    -valid = no
    valid users = YOUR-HC4-USER
    path = %P
    hide files = /$RECYCLE.BIN/System Volume Information/desktop.ini/thumbs.db/

# Add custom shares in smb-shares.conf instead of editing smb.conf so they will not be
# overwritten by samba updates. You can only add new shares to smb-shares.conf, not change
# the default shares or global options. If you need full control see smb-local.conf above.

include = /etc/samba/smb-shares.conf

 

Users are handled by:

 

include = /etc/samba/smb-shares.conf

 

This is an example how my "/etc/samba/smb-shares.conf" is composed and is taken by my documentation, but matches my current setup:


 

[public]
  comment =Public Storage
  path = /srv/samba/public
  valid users = @users
  force group = users
  create mask = 0660
  directory mask = 0771
  read only = no


[MyUSER]
    browsable = yes
    read only = no
    valid users = YOUR-HC4-USER, MyUSER
    path = /srv/samba/MyUSER
    comment = MyUSER Folder
    force group = users
    locking = no
    create mask = 0765
    directory mask = 0765

 

Of course if I remove from "smbd.conf" this line:

 

config file = /etc/samba/smb-local.conf

 

The systemd service doesn't fail... But with my configuration "testparm -s" doesn't fail either...

 

$ testparm -s
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed

Server role: ROLE_STANDALONE

# Global parameters
[global]
        config file = /etc/samba/smb-local.conf
        log file = /var/log/samba/log.%m
        logging = file
        map to guest = Bad User
        max log size = 1000
        obey pam restrictions = Yes
        pam password change = Yes
        panic action = /usr/share/samba/panic-action %d
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

        passwd program = /usr/bin/passwd %u
        server role = standalone server
        server string = %h server (Samba, Ubuntu)
        unix password sync = Yes
        usershare allow guests = Yes
        idmap config * : backend = tdb


[printers]
        browseable = No
        comment = All Printers
        create mask = 0700
        path = /var/spool/samba
        printable = Yes


[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers

 

Thanks! 🙏🙏🙏

Link to comment
Share on other sites

Help Armbian team helping you

  • Solution

I found the culprit and was this line:

 

lock directory = /var/cache/samba

 

For testing I created "/var/cache/samba/locks" but it didn't work either...

 

This link says it safe using default setup:

 

https://www.linuxtopia.org/online_books/network_administration_guides/using_samba_book/ch05_05_11.html

 

Therefore for the moment I commented it to make the smbd,service working...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...