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: 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. 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
On 07/04/2023 20:20, David Bear via samba 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: > > 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. > > 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 ? >As far as I am aware, there isn't one. There is however, a samba C module that python can use and the samba in 'samba.netcmd.user' is a directory. A long time ago, I had the same problem and couldn't understand why you would name a C module 'samba'. Can I ask why you are trying to use Python to do something that sounds like something that samba-tool can already do ? For most of this you could just write a wrapper around samba-tool, or use LAM or something similar. From my understanding, ChatGPT can only work with what is out there on the internet and most of what is out there about Samba is full of errors and omissions. Rowland
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