amitkuma at redhat.com
2019-Aug-10 12:14 UTC
[Samba] samba-tool ou create "OU=del-ou, dc=atest, dc=com" fails with /var/lib/samba/private/sam.ldb: No such file or directory
Hello, I am trying to use samba-tool to create OU on active directory. 1. Joined to domain. # net ads join -U <> 2. Listed GPO's on domain to check samba-tool script can pull the GPOs. # samba-tool gpo listall GPO : <> display name : test-Computers-GPO-1 path : \\atest.com\SysVol\atest.com\Policies\<> dn : <>,CN=Policies,CN=System,DC=atest,DC=com version : 65536 flags : NONE GPO : <> display name : empty-gpo-from-samba-tool path : \\atest.com\sysvol\atest.com\Policies\<> dn : CN=<>,CN=Policies,CN=System,DC=atest,DC=com version : 0 flags : NONE GPO : <> display name : Default Domain Policy path : \\atest.com\sysvol\atest.com\Policies\<> dn : CN=<>,CN=Policies,CN=System,DC=atest,DC=com version : <> flags : NONE GPO : <> display name : smart-card-gpo path : \\atest.com\SysVol\atest.com\Policies\<> dn : CN=<>,CN=Policies,CN=System,DC=atest,DC=com version : <> flags : NONE GPO : <> display name : Default Domain Controllers Policy path : \\atest.com\sysvol\atest.com\Policies\<> dn : CN=<>,CN=Policies,CN=System,DC=atest,DC=com version : 2 flags : NONE 3. Tried creating OU on Active Directory. # samba-tool ou create "OU=del-ou,dc=atest,dc=com" ltdb: tdb(/var/lib/samba/private/sam.ldb): tdb_open_ex: could not open file /var/lib/samba/private/sam.ldb: No such file or directory Unable to open tdb '/var/lib/samba/private/sam.ldb': No such file or directory Failed to connect to 'tdb:///var/lib/samba/private/sam.ldb' with backend 'tdb': Unable to open tdb '/var/lib/samba/private/sam.ldb': No such file or directory ERROR(ldb): uncaught exception - Unable to open tdb '/var/lib/samba/private/sam.ldb': No such file or directory File "/usr/lib64/python3.7/site-packages/samba/netcmd/__init__.py", line 185, in _run return self.run(*args, **kwargs) File "/usr/lib64/python3.7/site-packages/samba/netcmd/ou.py", line 201, in run credentials=creds, lp=lp) File "/usr/lib64/python3.7/site-packages/samba/samdb.py", line 67, in __init__ options=options) File "/usr/lib64/python3.7/site-packages/samba/__init__.py", line 115, in __init__ self.connect(url, flags, options) File "/usr/lib64/python3.7/site-packages/samba/samdb.py", line 82, in connect options=options) Any pointers? Thanks Amit
Rowland penny
2019-Aug-10 12:25 UTC
[Samba] samba-tool ou create "OU=del-ou, dc=atest, dc=com" fails with /var/lib/samba/private/sam.ldb: No such file or directory
On 10/08/2019 13:14, amitkuma--- via samba wrote:> Hello, > > I am trying to use samba-tool to create OU on active directory. > > 1. Joined to domain. > # net ads join -U <> > > 2. Listed GPO's on domain to check samba-tool script can pull the GPOs. > # samba-tool gpo listall > GPO : <> > display name : test-Computers-GPO-1 > path : \\atest.com\SysVol\atest.com\Policies\<> > dn : <>,CN=Policies,CN=System,DC=atest,DC=com > version : 65536 > flags : NONE > > GPO : <> > display name : empty-gpo-from-samba-tool > path : \\atest.com\sysvol\atest.com\Policies\<> > dn : CN=<>,CN=Policies,CN=System,DC=atest,DC=com > version : 0 > flags : NONE > > GPO : <> > display name : Default Domain Policy > path : \\atest.com\sysvol\atest.com\Policies\<> > dn : CN=<>,CN=Policies,CN=System,DC=atest,DC=com > version : <> > flags : NONE > > GPO : <> > display name : smart-card-gpo > path : \\atest.com\SysVol\atest.com\Policies\<> > dn : CN=<>,CN=Policies,CN=System,DC=atest,DC=com > version : <> > flags : NONE > > GPO : <> > display name : Default Domain Controllers Policy > path : \\atest.com\sysvol\atest.com\Policies\<> > dn : CN=<>,CN=Policies,CN=System,DC=atest,DC=com > version : 2 > flags : NONE > > 3. Tried creating OU on Active Directory. > # samba-tool ou create "OU=del-ou,dc=atest,dc=com" > ltdb: tdb(/var/lib/samba/private/sam.ldb): tdb_open_ex: could not open file /var/lib/samba/private/sam.ldb: No such file or directory > > Unable to open tdb '/var/lib/samba/private/sam.ldb': No such file or directory > Failed to connect to 'tdb:///var/lib/samba/private/sam.ldb' with backend 'tdb': Unable to open tdb '/var/lib/samba/private/sam.ldb': No such file or directory > ERROR(ldb): uncaught exception - Unable to open tdb '/var/lib/samba/private/sam.ldb': No such file or directory > File "/usr/lib64/python3.7/site-packages/samba/netcmd/__init__.py", line 185, in _run > return self.run(*args, **kwargs) > File "/usr/lib64/python3.7/site-packages/samba/netcmd/ou.py", line 201, in run > credentials=creds, lp=lp) > File "/usr/lib64/python3.7/site-packages/samba/samdb.py", line 67, in __init__ > options=options) > File "/usr/lib64/python3.7/site-packages/samba/__init__.py", line 115, in __init__ > self.connect(url, flags, options) > File "/usr/lib64/python3.7/site-packages/samba/samdb.py", line 82, in connect > options=options) > > Any pointers? > > Thanks > Amit >Yes, run the command on a Samba AD DC, or use '-H ldap://DC_SHORT_HOSTNAME' Rowland
Amit Kumar
2019-Aug-10 12:35 UTC
[Samba] samba-tool ou create "OU=del-ou, dc=atest, dc=com" fails with /var/lib/samba/private/sam.ldb: No such file or directory
On 08/10/2019 05:55 PM, Rowland penny via samba wrote:> On 10/08/2019 13:14, amitkuma--- via samba wrote: >> Hello, >> >> I am trying to use samba-tool to create OU on active directory. >> >> 1. Joined to domain. >> # net ads join -U <> >> >> 2. Listed GPO's on domain to check samba-tool script can pull the GPOs. >> # samba-tool gpo listall >> GPO????????? : <> >> display name : test-Computers-GPO-1 >> path???????? : \\atest.com\SysVol\atest.com\Policies\<> >> dn?????????? : <>,CN=Policies,CN=System,DC=atest,DC=com >> version????? : 65536 >> flags??????? : NONE >> >> GPO????????? : <> >> display name : empty-gpo-from-samba-tool >> path???????? : \\atest.com\sysvol\atest.com\Policies\<> >> dn?????????? : CN=<>,CN=Policies,CN=System,DC=atest,DC=com >> version????? : 0 >> flags??????? : NONE >> >> GPO????????? : <> >> display name : Default Domain Policy >> path???????? : \\atest.com\sysvol\atest.com\Policies\<> >> dn?????????? : CN=<>,CN=Policies,CN=System,DC=atest,DC=com >> version????? : <> >> flags??????? : NONE >> >> GPO????????? : <> >> display name : smart-card-gpo >> path???????? : \\atest.com\SysVol\atest.com\Policies\<> >> dn?????????? : CN=<>,CN=Policies,CN=System,DC=atest,DC=com >> version????? : <> >> flags??????? : NONE >> >> GPO????????? : <> >> display name : Default Domain Controllers Policy >> path???????? : \\atest.com\sysvol\atest.com\Policies\<> >> dn?????????? : CN=<>,CN=Policies,CN=System,DC=atest,DC=com >> version????? : 2 >> flags??????? : NONE >> >> 3. Tried creating OU on Active Directory. >> # samba-tool ou create "OU=del-ou,dc=atest,dc=com" >> ltdb: tdb(/var/lib/samba/private/sam.ldb): tdb_open_ex: could not >> open file /var/lib/samba/private/sam.ldb: No such file or directory >> >> Unable to open tdb '/var/lib/samba/private/sam.ldb': No such file or >> directory >> Failed to connect to 'tdb:///var/lib/samba/private/sam.ldb' with >> backend 'tdb': Unable to open tdb '/var/lib/samba/private/sam.ldb': >> No such file or directory >> ERROR(ldb): uncaught exception - Unable to open tdb >> '/var/lib/samba/private/sam.ldb': No such file or directory >> ?? File >> "/usr/lib64/python3.7/site-packages/samba/netcmd/__init__.py", line >> 185, in _run >> ???? return self.run(*args, **kwargs) >> ?? File "/usr/lib64/python3.7/site-packages/samba/netcmd/ou.py", line >> 201, in run >> ???? credentials=creds, lp=lp) >> ?? File "/usr/lib64/python3.7/site-packages/samba/samdb.py", line 67, >> in __init__ >> ???? options=options) >> ?? File "/usr/lib64/python3.7/site-packages/samba/__init__.py", line >> 115, in __init__ >> ???? self.connect(url, flags, options) >> ?? File "/usr/lib64/python3.7/site-packages/samba/samdb.py", line 82, >> in connect >> ???? options=options) >> >> Any pointers? >> >> Thanks >> Amit >> > Yes, run the command on a Samba AD DC, or use '-H > ldap://DC_SHORT_HOSTNAME'Thanks rowland it? worked with: # samba-tool ou create "OU=del-ou,dc=atest,dc=com" -H 'ldap://DC_SHORT_HOSTNAME' --simple-bind-dn 'CN=Administrator,CN=Users,DC=atest,DC=com' --password <>> > Rowland > >