[opensuse] samba net share command
Hi all I am trying to use the SAMBA net share command on openSUSE Leap 15.1 For example: net rpc share add c1=/array/c/1 -U user%pass I get this error: NetShareAdd failed with: Access is denied. It seems that I need to add a script to run in my smb.conf file. The error message is misleading, it would appear. This seems to sum thing up nicely: A share can be added using the net rpc share command capabilities. The target machine may be local or remote and is specified by the -S option. It must be noted that the addition and deletion of shares using this tool depends on the availability of a suitable interface script. The interface scripts Sambas smbd uses are called 'add share command', 'delete share command' and 'change share command'. A set of example scripts are provided in the Samba source code tarball in the directory ~samba/examples/scripts. I thought that the SAMBA 'net' command was complete in that the share add command knew what to do. Seems not. I need a script to be run when I do the command above. I have been looking for sample scripts, but I have not found anything. I looked in the samba RPM to see if there is an example. I don't see anything. Is anyone using the 'net share add' command? -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Tue, Jul 14, 2020 at 9:35 AM Roger Oberholtzer <roger.oberholtzer@gmail.com> wrote:
Hi all
I am trying to use the SAMBA net share command on openSUSE Leap 15.1
For example:
net rpc share add c1=/array/c/1 -U user%pass
I get this error:
NetShareAdd failed with: Access is denied.
It seems that I need to add a script to run in my smb.conf file. The error message is misleading, it would appear.
This seems to sum thing up nicely:
A share can be added using the net rpc share command capabilities. The target machine may be local or remote and is specified by the -S option. It must be noted that the addition and deletion of shares using this tool depends on the availability of a suitable interface script. The interface scripts Sambas smbd uses are called 'add share command', 'delete share command' and 'change share command'. A set of example scripts are provided in the Samba source code tarball in the directory ~samba/examples/scripts.
I thought that the SAMBA 'net' command was complete in that the share add command knew what to do. Seems not. I need a script to be run when I do the command above. I have been looking for sample scripts, but I have not found anything. I looked in the samba RPM to see if there is an example. I don't see anything.
Is anyone using the 'net share add' command?
If I look at a sample script: https://gitlab.com/samba-team/devel/samba/-/blob/c0cbf5936f0385ab93315cc366a... It seems that it 'simply' edits the smb.conf file. Is this what one needs to do when using the 'net add share' command? Write/provide a script that modifies smb.conf? And then the 'net' command tells smb to reread the file and do any updates? This implies that this must also always be done as root. And it begs the question: why does it want the smb user/password? It's only modifying a local configuration file. I must be getting this all wrong. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Tuesday, 14 July 2020 17:26:28 ACST Roger Oberholtzer wrote:
On Tue, Jul 14, 2020 at 9:35 AM Roger Oberholtzer
<roger.oberholtzer@gmail.com> wrote:
Hi all
I am trying to use the SAMBA net share command on openSUSE Leap 15.1
For example: net rpc share add c1=/array/c/1 -U user%pass
I get this error: NetShareAdd failed with: Access is denied.
It seems that I need to add a script to run in my smb.conf file. The error message is misleading, it would appear.
This seems to sum thing up nicely:
A share can be added using the net rpc share command capabilities. The target machine may be local or remote and is specified by the -S option. It must be noted that the addition and deletion of shares using this tool depends on the availability of a suitable interface script. The interface scripts Sambas smbd uses are called 'add share command', 'delete share command' and 'change share command'. A set of example scripts are provided in the Samba source code tarball in the directory ~samba/examples/scripts.
I thought that the SAMBA 'net' command was complete in that the share add command knew what to do. Seems not. I need a script to be run when I do the command above. I have been looking for sample scripts, but I have not found anything. I looked in the samba RPM to see if there is an example. I don't see anything.
Is anyone using the 'net share add' command?
If I look at a sample script:
https://gitlab.com/samba-team/devel/samba/-/blob/c0cbf5936f0385ab93315cc366a 0aa16c0ebd237/examples/scripts/shares/python/modify_samba_config.py
It seems that it 'simply' edits the smb.conf file. Is this what one needs to do when using the 'net add share' command? Write/provide a script that modifies smb.conf? And then the 'net' command tells smb to reread the file and do any updates? This implies that this must also always be done as root. And it begs the question: why does it want the smb user/password? It's only modifying a local configuration file.
I must be getting this all wrong.
It probably needs the Samba (or domain) administrator account to add the share. This is consistent behaviour with (for example) AD on Windows - only domain admins can add domain-wide shares. -- ============================================================== Rodney Baker VK5ZTV rodney.baker@iinet.net.au CCNA #CSCO12880208 ============================================================== -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Tue, Jul 14, 2020 at 10:48 AM Rodney Baker <rodney.baker@iinet.net.au> wrote:
I must be getting this all wrong.
It probably needs the Samba (or domain) administrator account to add the share. This is consistent behaviour with (for example) AD on Windows - only domain admins can add domain-wide shares.
Okay. Giving the password was not the real issue. Just a curiosity. I am more confused about the need to provide a script. And the apparent lack of default scripts for simple uses like adding a share on the local SAMBA server. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 07/14/2020 04:47 AM, Roger Oberholtzer wrote:
It probably needs the Samba (or domain) administrator account to add the share. This is consistent behaviour with (for example) AD on Windows - only domain admins can add domain-wide shares. Okay. Giving the password was not the real issue. Just a curiosity. I am more confused about the need to provide a script. And the apparent lack of default scripts for simple uses like adding a share on the local SAMBA server.
I've never played with net share before on samba. I'll have to read up on it. Looking at your gitlab script (cough... Python...) that is simply a glorified way to automate editing /etc/samba/smb.conf. If your shares are permanent, simply add your new shares by hand, save and restart (smb/nmb if running in standalone mode) or restart samba if using the domain controller features, etc.. You should have several example shares in the current smb.conf, thankfully there isn't much to them. For example, I have a 3T mdadm raid1 share mounted at /home/data (which I uncreatively share as "data") and this is all that is needed: [data] comment = %h - Data force group = skyline inherit permissions = Yes path = /home/data read only = No valid users = @skyline net share may be a bit different or have one or two more options, but should be very similar. -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 07/16/2020 08:49 PM, David C. Rankin wrote:
simply add your new shares by hand, save and restart (smb/nmb if running in standalone mode) or restart samba if using the domain controller features, etc..
Checking, openSUSE now uses separate smb and nmb services for standalone (good) and samba-ad-dc.service for the full samba offering. -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Fri, Jul 17, 2020 at 3:49 AM David C. Rankin <drankinatty@suddenlinkmail.com> wrote:
On 07/14/2020 04:47 AM, Roger Oberholtzer wrote:
It probably needs the Samba (or domain) administrator account to add the share. This is consistent behaviour with (for example) AD on Windows - only domain admins can add domain-wide shares. Okay. Giving the password was not the real issue. Just a curiosity. I am more confused about the need to provide a script. And the apparent lack of default scripts for simple uses like adding a share on the local SAMBA server.
I've never played with net share before on samba. I'll have to read up on it. Looking at your gitlab script (cough... Python...) that is simply a glorified way to automate editing /etc/samba/smb.conf. If your shares are permanent, simply add your new shares by hand, save and restart (smb/nmb if running in standalone mode) or restart samba if using the domain controller features, etc..
The shares are not permanent. The server has 24 hot swappable drive bays. Disks come and go independently. Editing a file by hand is not an option. The net command seemed to be what I needed. But if it is just editing the smb.conf file via a script I have to write/provide, it's a strange critter. I am wondering what happens to existing shares that are in use when the smb server adds/removes others. Are they disrupted when the smb server restarts? Or does the server have an update option that leaves unchanged shares alone? That is my primary worry. NFS' exportfs treats each share independently. They do not interfere with each other. SAMBA should have this too. At least it would help my use case. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 07/17/2020 04:05 AM, Roger Oberholtzer wrote:
The shares are not permanent. The server has 24 hot swappable drive bays. Disks come and go independently. Editing a file by hand is not an option. The net command seemed to be what I needed. But if it is just editing the smb.conf file via a script I have to write/provide, it's a strange critter. I am wondering what happens to existing shares that are in use when the smb server adds/removes others. Are they disrupted when the smb server restarts? Or does the server have an update option that leaves unchanged shares alone? That is my primary worry. NFS' exportfs treats each share independently. They do not interfere with each other. SAMBA should have this too. At least it would help my use case.
Modifying the smb.conf to add or remove shares doesn't impact shares that are unchanged. If you have an ongoing transfer to a share that doesn't change, it won't be interrupted by a reload. The python script makes more sense if shares are coming/going based on what is plugged in. The samba mailing list 'samba@lists.samba.org' is a very good and responsive list to help get features working. -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (3)
-
David C. Rankin
-
Rodney Baker
-
Roger Oberholtzer