[Samba] idamp ad/rid

lingpanda101 lingpanda101 at gmail.com
Mon Dec 4 14:14:57 UTC 2017


On 12/2/2017 10:10 AM, Rowland Penny via samba wrote:
> On Sat, 2 Dec 2017 12:13:08 -0200
> Elias Pereira via samba <samba at lists.samba.org> wrote:
>
>>> Sorry, but that isn't going to work with 'samba-tool user edit'
>>> You would need to write an 'editor' script to do what you would
>>> need to do.
>>
>> Ok.
>>
>> Bit busy, just now, give me some time, I have a script somewhere that
>>> should do what you want.
>>
>> Of course Rowland. Work on what you're working on. I do not want to
>> disturb you. :)
>>
>> I'll give a researched on the "editor" script.
>>
>> Thanks again for the help !!! :)
>>
>> On Sat, Dec 2, 2017 at 11:01 AM, Rowland Penny via samba <
>> samba at lists.samba.org> wrote:
>>
>>> On Sat, 2 Dec 2017 10:21:07 -0200
>>> Elias Pereira <empbilly at gmail.com> wrote:
>>>
>>>> Correcting! :)
>>>>
>>>> #!/bin/bash
>>>> #
>>>> GROUP=ADM
>>>> GUID=10000      # Domain Users
>>>> UID=10000         # get the next ID ?
>>>>
>>>> for USER in $(samba-tool group listmembers $GROUP)
>>>> do
>>>>      samba-tool user edit $USER --nis-domain=samdom \
>>>>      --unix-home=/home/$USER \
>>>>      --uid-number=${NEXTID} \
>>>>      --login-shell=/sbin/nologin \
>>>>      --gid-number=$GUID
>>>> done
>>>>
>>>>
>>>> Of course that script is very simple, but is a beginning. :)
>>>>
>>>> Can you help me to make this script?
>>>>
>>>> On Sat, Dec 2, 2017 at 10:05 AM, Elias Pereira
>>>> <empbilly at gmail.com> wrote:
>>>>
>>>>> Found it! :)
>>>>>
>>>>> I thought in make a script more or less that way.
>>>>>
>>>>> #!/bin/bash
>>>>> #
>>>>> GROUP=ADM
>>>>> GUID=10000      # Domain Users
>>>>> UID=10000         # get the next ID ?
>>>>>
>>>>> for USER in $(samba-tool group listmembers $GROUP)
>>>>> do
>>>>>      samba-tool user edit $USER -H ldap://samdom.example.com \
>>>>>      -U administrato --nis-domain=samdom \
>>>>>      --unix-home=/home/$USER \
>>>>>      --uid-number=${NEXTID} \
>>>>>      --login-shell=/sbin/nologin \
>>>>>      --gid-number=$GUID
>>>>> done
>>>>>
>>>>>
>>>>> Of course that script is very simple, but is a beginning. :)
>>>>>
>>>>> Can you help me to make this script?
>>>>>
>>> Sorry, but that isn't going to work with 'samba-tool user edit'
>>> You would need to write an 'editor' script to do what you would
>>> need to do.
>>>
>>> Bit busy, just now, give me some time, I have a script somewhere
>>> that should do what you want.
>>>
>>> Rowland
>>>
>>> --
>>> To unsubscribe from this list go to the following URL and read the
>>> instructions:  https://lists.samba.org/mailman/options/samba
>>>
>>
>>
> Found it and tested it, still works ;-)
>
> Hope you can understand it, all you need do is open sam.ldb with
> ldbedit, find
> 'CN=your_workgroup_name,CN=ypservers,CN=ypServ30,CN=RpcServices,CN=System,DC=your,DC=dns,DC=name'
>
> Add:
> msSFU30MaxUidNumber: 'the start number for your UIDs'
>
> Close and save sam.ldb
>
> Then feed the script with the required info, I would suggest you try it
> with just one user first.
>
> Rowland

This was my attempt at getting the next uid. Maybe it can assist with 
this project? If not I'll climb back down in my hole.

#!/bin/bash

result=$(ldbsearch -H /usr/local/samba/private/sam.ldb | grep 
"uidNumber:" | sort -n | cut -d\      -f2 |tail -n1)

uid1=$(echo $((result+1)))
echo $uid1


-- 
--
James




More information about the samba mailing list