Re: samba-tool group addmembers error - string_to_sid: SID <groupname> is not in a valid format

Rowland Penny via samba <[email protected]> Sat, 11 Apr 2026 08:14:06 +0100
Newsgroups gmane.network.samba.general
Message-ID <[email protected]>
On Fri, 10 Apr 2026 10:57:47 +0200
Marco Gaiarin via samba <[email protected]> wrote:

> 
> I've found reference online on this error, but dated about samba
> 4.1...
> 
> Domain member samba 4.22.4-18.el9_7.x86_64, joined to an MS AD domain.
> 
> I've created groups via 'samba-tool group add', and group exist:
> 
>  [adminmgaiarin@ppfs1 ~]$ wbinfo -g | grep fvg_sir
>  fvg_sir
>  [adminmgaiarin@ppfs1 ~]$ getent group fvg_sir
>  fvg_sir:x:504233:
>  [adminmgaiarin@ppfs1 ~]$ wbinfo -n fvg_sir
>  S-1-5-21-3195041156-2418829160-2956828833-4233 SID_ALIAS (4)
> 
> but:
> 
>  [adminmgaiarin@ppfs1 ~]$ samba-tool group addmembers fvg_sir
> marco.gaiarin --URL=ldap://ppdc1.fvg.ad.lnf.it -U adminmgaiarin -d 3
> lpcfg_load: refreshing parameters from /etc/samba/smb.conf Tried to
> load /etc/samba/smb.conf.%M but variable substitution in filename,
> ignoring file. resolve_lmhosts: Attempting lmhosts lookup for name
> ppdc1.fvg.ad.lnf.it<0x20> GENSEC backend 'gssapi_spnego' registered
> [...] GENSEC backend 'http_negotiate' registered
>  Password for [LNF_FVG\adminmgaiarin]:
>  string_to_sid: SID fvg_sir is not in a valid format
>  ERROR: Failed to add members ['marco.gaiarin'] to group "fvg_sir" -
> Unable to find group "fvg_sir" File
> "/usr/lib64/python3.9/site-packages/samba/netcmd/group.py", line 486,
> in run samdb.add_remove_group_members(groupname, groupmembers, File
> "/usr/lib64/python3.9/site-packages/samba/samdb.py", line 467, in
> add_remove_group_members raise Exception('Unable to find group "%s"'
> % group)
> 
> Why?! Thanks.
> 

I think this is all down to you seemingly having /etc/samba/smb.conf.%M
instead of /etc/samba/smb.conf . The %M is used internally by smb.conf
as a substitute for the clients hostname, so why try and use it
externally ?

What I think is happening is, the samba-tool command tries to read the
smb.conf file and fails, this leads to winbind being unable to map the
SID to an ID, so you get 'SID_ALIAS' (something I can never remember
seeing). Try removing the '.%M' from /etc/samba/smb.conf.%M and see if
that cures your problem.

Rowland

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba