[Samba] how edit users via script

Phil Pishioneri pgp at psu.edu
Thu Jun 22 14:27:07 UTC 2023


On 2023/6/22 5:05 AM, Anton Shevtsov via samba wrote:
> [root at dc extend]# rpm -q samba
> samba-4.16.10-alt1.x86_64
>
> [root at dc extend]# cat /etc/os-release
> ...
>
>> I ask this because it is working for myself.
>>
> ok, how i can add , for example, 'department' attribute for all 
> simpleuser*
>
> for i in $(samba-tool user list | grep '^simpleuser'); do
>
> samba-tool user edit $i | sed/awk/anythinghere ?
>
> done


(Untested) You might try something like (for the edit line)

samba-tool user edit --editor=script-to-add-department  $i

where "script-to-add-department" is the path to a shell script which 
invokes sed/awk. The script should expect a filename as its first/only 
parameter (but that's something to test).

-Phil




More information about the samba mailing list