Monday, May 18, 2015

Samba 4.1 - problem with permission in Debian Wheezy (solved)

First you must install: ldb-tools
$ apt-get install ldb-tools
Adding User into Samba (smbpasswd)
$ smbpasswd -a USERNAME1
$ samba-tool user add USERNAME1
To inspect the allocated user ID and SID
$ wbinfo --name-to-sid USERNAME1
S-1-5-21-1380947744-608041358-3555098087-1105 SID_USER (1)
$ wbinfo --sid-to-uid S-1-5-21-1380947744-608041358-3555098087-1105

$ ldbedit -e mcedit -H /usr/local/samba/private/idmap.ldb objectsid=S-1-5-21-1380947744-608041358-3555098087-1105

# editing 1 records
# record 1
dn: CN=S-1-5-21-1380947744-608041358-3555098087-1103
cn: S-1-5-21-1380947744-608041358-3555098087-1103
objectClass: sidMap
objectSid: S-1-5-21-1380947744-608041358-3555098087-1103
xidNumber: [There you write your id from /etc/passwd]
distinguishedName: CN=S-1-5-21-1380947744-608041358-3555098087-1103