<netAPI> [Guenther-sir] NetShareAdd not working samba 3.5.8

okmanoj at indiatimes.com okmanoj at indiatimes.com
Wed May 4 20:51:55 MDT 2011

Dear Motonobu-San,

Thank you very much for your information share, I understood the concept and usage now.

I have modified my application now and able to perform all Fileshare operation smoothly. 

I have one more query related to libNetAPI in the same test application.

While modifying same sample application using libnetAPI I am able to successfully join Test Device to win2k8r2 server.

I am using below parameter for joining

NetJoinDomain ("MANOJTESTAPI"     /*Name of my device to join*/,
               "2k8"              /*Domain Name of the server to join*/,
               "CN=Computers,DC=2k8,DC=ms,DC=local"       /*account OU of the 2k8r2 server*/,
               "username"         /*Admin username of the server account*/,
               "password"         /*password of the above username*/,
                NETSETUP_ACCT_CREATE |NETSETUP_JOIN_DOMAIN /*flags for join*/)

With above parameter I am able to join successfully, also I am able to see my device account in domain server under "CN=Computers,DC=2k8,DC=ms,DC=local".

Now I want to un-join my device form win2k8servr and delete my account i am using below API format

NetUnjoinDomain ("MANOJTESTAPI"     /*Name of my device to join*/,
               "username"         /*Admin username of the server account*/,
               "password"         /*password of the above username*/,
                NETSETUP_ACCT_DELETE |NETSETUP_JOIN_DOMAIN /*flags for un-join*/)

But with this I am not able to delete the account in server. I am getting error "failed to disable machine account via rpc: No such domain"

Please suggest If I am doing anything wrong in un-join Process. I have also attached samba debug 100 logs 

I have attached samba logs in 

Please let me know if this issue need more info.


----- Original Message -----
From: TAKAHASHI Motonobu <monyo at monyo.com>
To: okmanoj at indiatimes.com
Cc: samba-technical at lists.samba.org
Sent: Tue, 3 May 2011 15:12:44 +0530 (IST)
Subject: Re: <netAPI> [Guenther-sir] NetShareAdd not working samba 3.5.8

From: okmanoj at indiatimes.com
Date: Tue, 3 May 2011 11:50:01 +0530 (IST)

> I am trying to create test application in linux which will dynamically add samba file share to local Linux.


> My reg conf looks like


>         add share command = /home/manoj/project/installed/samba-3.5.8/bin/net conf addshare
> When I ran samba test binary share_add ""  "FS3" "/home"
> It returned "WERR_ACCESS_DENIED"
> While debugging i found in logs


> means "/home/manoj/project/installed/samba-3.5.8/bin/net conf addshare "/home/manoj/project/config/smb.conf" "fs3" "/home" "Test share created via NetApi" 0"
> however correct format for  "net conf addshare" is /home/manoj/project/installed/samba-3.5.8/bin/net conf addshare "fs5" "/home" "writeable=n" "guest_ok=y" "Test share created via NetApi"


> I believe samba source will NOT have this basic problem, May be I am doing something wrong.

"add share command" parameter is not intended to work with "net conf
addshare" nor "net usershare". You need to create a custom script
suitable for "add share command". See smb.conf(5).

* smb.conf(5) included in Samba 3.5.8 is broken, look at another

TAKAHASHI Motonobu <monyo at samba.gr.jp>

More information about the samba-technical mailing list