Samba WERR_ACCESS_DENIED

New Manjaro install, trying to set up SAMBA share. I keep getting the same error.

Failed to add share

net: Failed to initialize the registry: WERR_ACCESS_DENIED
Can't load /etc/samba/smb.conf - run testparm to debug it
Failed to initialize the registry: WERR_ACCESS_DENIED (255)

testparm                                                         ✔ 
Load smb config files from /etc/samba/smb.conf
regdb_init: Failed to open registry /var/lib/samba/registry.tdb (Permission denied)
Failed to initialize the registry: WERR_ACCESS_DENIED
error initializing registry configuration: SBC_ERR_BADFILE
Error loading services.

sudo testparm                                                  1 ✘ 
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed by GnuTLS (e.g. NTLM as a compatibility fallback)

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
        client min protocol = SMB2
        disable spoolss = Yes
        dns proxy = No
        load printers = No
        log file = /var/log/samba/%m.log
        map to guest = Bad Password
        max log size = 1000
        name resolve order = lmhosts bcast host wins
        obey pam restrictions = Yes
        pam password change = Yes
        passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*
        passwd program = /usr/bin/passwd %u
        printcap name = /dev/null
        registry shares = Yes
        security = USER
        server role = standalone server
        show add printer wizard = No
        unix password sync = Yes
        usershare allow guests = Yes
        usershare max shares = 100
        usershare path = /var/lib/samba/usershare
        idmap config * : backend = tdb
        force create mode = 0070
        force directory mode = 0070
        printing = bsd


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


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


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

Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

1 Like

registry.tdb permissions may be wrong. Execute commands:

sudo ls -l /var/lib/samba/registry.tdb

and

ps -aux | grep smb

And copy here the output.

sudo ls -l /var/lib/samba/registry.tdb
rw-rw---- 1 nobody root 421888 Feb 27 10:02 /var/lib/samba/registry.tdb

ps -aux | grep smb                                               ✔ 
root         596  0.0  0.3  93348 26752 ?        Ss   12:03   0:00 /usr/bin/smbd --foreground --no-process-group
root         602  0.0  0.0  90828  6400 ?        S    12:03   0:00 smbd: notifyd 
root         603  0.0  0.0  90836  5760 ?        S    12:03   0:00 smbd: cleanupd
john        4548  0.0  0.0   6580  2432 pts/1    S+   13:03   0:00 grep smb

Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

This guide might be of some help. Is your user name a member of the sambashare group?
You may fare better setting up samba file sharing via your file manager. Thunar has thunar-shares-plugin. It is fine for basic file sharing between my various Manjaro systems. Maybe Dolphin/KDE has something similar?

It’s built into KDE Dolphin file manager… and throwing off the same error. :frowning:

It is fairly obvious why it won’t work

You are missing the /etc/samba/smb.conf or it is misconfigured.

Even the most basic samba requires knowledge … and nothing with relation to samba comes pre-configured.

You must learn how to configure samba and the topic linked above describes how you setup a basic samba service.

Another topic is [root tip] [How To] Samba Server From Scratch which goes into more details regarding permissions and user access.

A forum search for samba will also reveal a lot of topics.

If you want to create a user share using your file manager - besides configuring the samba server service - see the usershares section → [root tip] [How To] Basic Samba Setup and Troubleshooting

Well, I do have a samba.conf (see below) and I have gone through a bunch of sources to try to identify what is wrong. WERR_ACCESS_DENIED seems to be a permissions issue, not a configuration issue, but I’d sure appreciate any review of the .conf file to see if anything is wrong there that could be driving it.

[global]
   workgroup = WORKGROUP
   dns proxy = no
   log file = /var/log/samba/%m.log
   max log size = 1000
   client min protocol = SMB2
   server role = standalone server
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*
   pam password change = yes
   map to guest = Bad Password
   usershare allow guests = yes
   name resolve order = lmhosts bcast host wins
   security = user
   guest account = nobody
   usershare path = /var/lib/samba/usershare
   usershare max shares = 100
   usershare owner only = yes
   force create mode = 0070
   force directory mode = 0070
   load printers = no
   printing = bsd
   printcap name = /dev/null
   disable spoolss = yes
   show add printer wizard = no
   include = registry

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

[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no

Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

samba.conf or smb.conf?

Can't load /etc/samba/smb.conf 

Thanks, sorry, smb.conf

1 Like

A bit more info…

smbclient -L //sambaserver                                ✔  5s  
regdb_init: Failed to open registry /var/lib/samba/registry.tdb (Permission denied)
Failed to initialize the registry: WERR_ACCESS_DENIED
error initializing registry configuration: SBC_ERR_BADFILE
Can't load /etc/samba/smb.conf - run testparm to debug it
do_connect: Connection to sambaserver failed (Error NT_STATUS_INVALID_PARAMETER)

Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

move that smb.conf → smb.conf.bak

Then rewrite it using only the options you actually need → see the topics linked

For example - in the general section you specifically exclude printers but you define a share later - that is inconsistent.

I don’t know why you have this - you don’t need it - your smb.conf is a mess - and you are better off rewriting the config from scratch

If the goal is to share one or two folders from your user account

This should suffice

[global]
   workgroup = MANJARO
   server string = Manjaro Samba Server
   server role = standalone server
   log file = /var/log/samba/log.%m
   max log size = 50
   guest account = nobody
   map to guest = Bad Password

   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*
   pam password change = yes

   min protocol = SMB2
   max protocol = SMB3

  usershare path = /var/lib/samba/usershares
  usershare max shares = 100
  usershare allow guests = yes
  usershare owner only = yes

You still need to configure the usershares → [root tip] [How To] Basic Samba Setup and Troubleshooting

OK, followed that with new smb.conf, now I’m at the point where I have a new error, ‘var/lib/samba/usershares’ has its group owner inappropirately set to ‘root,’ which is not allowed… need to change folder’s group owner to ‘sambashares.’ I recognize that should use ‘sudo chown’ in some manner, but trying to figure out how, exactly… something like chown -hR sambashares /var/lib/samba/usershares ?

You neglected the steps outlined in the link …

Possibly you also neglected to create the necessary smbuser …

Well, this got me going… thanks to all who opined! A simple, fool proof tutorial on installing Samba - Linux Mint Forums

Creating entries like this in smb.conf solves the problem for me, anyway:

[Downloads]
path = /home/user/Downloads
read only = no
force user = root
guest ok = no