Web lists-archives.com

Re: [Samba] ntfs user mappings?




On Sun, 5 Nov 2017 16:14:33 -0700
Jeff Sadowski <jeff.sadowski@xxxxxxxxx> wrote:

> Not bad but I wanted an ldap version because I was having issues
> running ldbsearch as a normal user.
> 

I had another thought, why am I reinventing the wheel, so came up with
this:

#!/bin/bash

echo "#######################################################"
echo "#                                                     #"
echo "#      Please Wait whilst Usermap is created.         #"
echo "#                                                     #"
echo "#######################################################"

## Remove any existing usermap
if [ -f  /tmp/ntfs-3g.usermap ]; then
    rm -f /tmp/ntfs-3g.usermap
fi

WBINFO=$(which wbinfo)
if [ -z "${WBINFO}" ]; then
    echo
    echo "Cannot find 'wbinfo', is it installed?"
    echo "Cannot continue...Exiting"
    exit 1
fi

## Get users
ADUSERS=$(${WBINFO} -u)

## Get groups
ADGROUPS=$(${WBINFO} -g)

while IFS= read -r line
do
  SID=$(${WBINFO} -n "$line" | awk '{print $1}')
  echo "$line::$SID" >> /tmp/ntfs-3g.usermap
done <<< "$ADUSERS"

while IFS= read -r line
do
  SID=$(${WBINFO} -n "$line" | awk '{print $1}')
  echo ":$line:$SID" >> /tmp/ntfs-3g.usermap
done <<< "$ADGROUPS"

if [ -f /tmp/ntfs-3g.usermap ]; then
    echo
    echo "Usermap created in /tmp/ntfs-3g.usermap"
    echo
fi

exit 0

Anybody can run this, the only problem was '/etc/', only 'root' can
write into this directory, so I used '/tmp/' instead.

Rowland

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