Web lists-archives.com

Re: [Samba] ntfs user mappings?




. DOMAIN_ADMIN_PASSWD.sh
echo ${PASSWD} | kinit ${ADMIN}@${DOMAIN}
echo -n > /etc/ntfs-3g.usermap
for DOMAIN_USER in $(wbinfo -u);do
 RPCLOOKUPID=$(rpcclient -P -c "lookupnames ${DOMAIN_USER}" ${DOMAIN})
 if [ "${RPCLOOKUPID:0:7}" != "ERROR: " ] && [ "${RPCLOOKUPID:0:7}" !=
"Failed " ];then
  SID=$(echo ${RPCLOOKUPID}|awk '{print $2}')
  echo ${DOMAIN_USER}::${SID} >> /etc/ntfs-3g.usermap
 fi
done
for DOMAIN_GROUP in $(wbinfo -g);do
 RPCLOOKUPID=$(rpcclient -P -c "lookupnames ${DOMAIN_GROUP}" ${DOMAIN})
 if [ "${RPCLOOKUPID:0:7}" != "ERROR: " ] && [ "${RPCLOOKUPID:0:7}" !=
"Failed " ];then
  SID=$(echo ${RPCLOOKUPID}|awk '{print $2}')
  echo :${DOMAIN_GROUP}:${SID} >> /etc/ntfs-3g.usermap
 fi
done

On Sat, Nov 4, 2017 at 3:21 AM, Rowland Penny via samba
<samba@xxxxxxxxxxxxxxx> wrote:
> On Fri, 3 Nov 2017 16:25:57 -0600
> Jeff Sadowski <jeff.sadowski@xxxxxxxxx> wrote:
>
>> That looks easier
>>
>> I was working on ldap to convert but I'll try ldb-tools
>>
>> I was off on a bash mission here is what I had so far it isn't correct
>> so I'll keep working on it
>>
>> #!/bin/bash
>> if [ "$(echo $1|wc -c)" = "41" ];then
>> hex=$(echo $1|base64 -d| od -x -w28 --endian=big|head -n1|sed
>> 's/^0000000 //'|sed 's/ //g')
>> echo ${hex}
>> hex_chunk=$(echo ${hex}|cut -c1-2);
>> echo ${hex_chunk}
>> rev=$(echo "ibase=16; ${hex_chunk}" | bc)
>> hex_chunk=$(echo ${hex}|cut -c3-4)
>> echo ${hex_chunk}
>> dashes=$(echo "ibase=16; ${hex_chunk}" | bc)
>> hex_chunk=$(echo ${hex}|cut -c5-16)
>> echo ${hex_chunk}
>> notsure=$(echo "ibase=16; ${hex_chunk}" | bc)
>> hex_chunk=$(echo ${hex}|cut -c17-24)
>> echo ${hex_chunk}
>> issuer1=$(echo "ibase=16; ${hex_chunk}" | bc)
>> hex_chunk=$(echo ${hex}|cut -c25-32)
>> echo ${hex_chunk}
>> issuer2=$(echo "ibase=16; ${hex_chunk}" | bc)
>> hex_chunk=$(echo ${hex}|cut -c33-40)
>> echo ${hex_chunk}
>> issuer3=$(echo "ibase=16; ${hex_chunk}" | bc)
>> hex_chunk=$(echo ${hex}|cut -c41-48)
>> echo ${hex_chunk}
>> issuer4=$(echo "ibase=16; ${hex_chunk}" | bc)
>> hex_chunk=$(echo ${hex}|cut -c49-57)
>> uid=$(echo "ibase=16; ${hex_chunk}" | bc)
>> left=$(echo ${hex}|cut -c58-)
>> echo "[${left}]"
>> echo
>> "S-${rev}-${dashes}-${notsure}-${issuer1}-${issuer2}-${issuer3}-${issuer4}-${uid}"
>>
>> else
>> echo $1
>> echo "not 41 characters like I was expecting"
>> fi
>>
>
> Hmm, you could do this instead:
>
> #!/bin/bash
>
> ## Get users object into $1 with ldbsearch
>
> SID=$(echo $1 | grep 'objectSid:' | awk '{print $NF}')
> echo "$SID"
>
> Which would result in something like this:
>
> S-1-5-21-1768301897-3342589593-1064908849-1107
>
> Rowland
>
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba

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