[Samba] python module

Nico Kadel-Garcia nkadel at gmail.com
Sat Apr 8 05:35:24 UTC 2023


On Fri, Apr 7, 2023 at 3:22 PM David Bear via samba
<samba at lists.samba.org> wrote:
>
> I am looking for the python-samba module. I would like to
> add/disable/modify AD accounts using python running on a linux machine.
> ChatGPT suggested the python-samba module.  Sample code as follows:

Moo-ha-ha-ha. This is when looking at build packages helps, such as my
RHEL 8 backport tools at:

           https://github.com/nkadel/samba4repo/

And particularly:

          https://github.com/nkadel/samba-4.18.x-srpm/samba.spec

You'll see that the relevant python packages are built as part of the
samba build, itself. How it is packaged for your particular OS,
whether it has a "python-", python3-, or python39- depends on your
operating system packaging conventions.

Does that provide you enough hooks to find what you need?

> from samba.credentials import Credentials
> from samba.netcmd.user import create as create_user
> from samba.netcmd.user import setpassword as set_user_password
>
> ...
> I am running Debuan bullseye and I can import the samba module. But there
> is no samba.netcmd.user name available. So chatgpt suggested I need a newer
> version of python-samba.
>
> I attempted to pip install it -- and it is not available on pypi.

And it won't be, it's linked pretty firmly to the Samba source tree.

> After googling for about 15 minutes I gave up trying to find the
> python-samba module and thought I would ask -- is this something I need to
> get from git ?
>
> --
> David Bear
> mobile: (602) 903-6476
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba



More information about the samba mailing list