Creating CIFS shares en mass

Status
Not open for further replies.

dpearcefl

Contributor
Joined
Aug 4, 2015
Messages
145
I have a bunch of Windows shares to make and going through the GUI is a little daunting time-wise. I know we're not supposed to edit config file directly, but cutting and pasting in a conf file sure looks good.
 

dpearcefl

Contributor
Joined
Aug 4, 2015
Messages
145
DUH!!! of course.
 

dpearcefl

Contributor
Joined
Aug 4, 2015
Messages
145
Here is the python code I wound up using:
Code:
import json
import requests
r = requests.post(
   'http://hostname/api/v1.0/sharing/cifs/',
   auth=('root', 'password),
   headers={'Content-Type': 'application/json'},
   verify=False,
   data=json.dumps({
        "cifs_name": "sqldumps-blah",
        "cifs_path": "/mnt/tank2/Storage2/SQLDumps/Blah",
        "cifs_hostsallow": "",
        "cifs_auxsmbconf": "",
        "cifs_browsable": "false",
        "cifs_comment": "",
        "cifs_default_permissions": "true",
        "cifs_guestok": "true",
        "cifs_guestonly": "true",
        "cifs_home": "false",
        "cifs_hostsdeny": "ALL",
        "cifs_recyclebin": "false",
        "cifs_ro": "false",
        "cifs_showhiddenfiles": "false",
    })
  )

print r.text
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,553
Here is the python code I wound up using:
Code:
import json
import requests
r = requests.post(
   'http://hostname/api/v1.0/sharing/cifs/',
   auth=('root', 'password),
   headers={'Content-Type': 'application/json'},
   verify=False,
   data=json.dumps({
        "cifs_name": "sqldumps-blah",
        "cifs_path": "/mnt/tank2/Storage2/SQLDumps/Blah",
        "cifs_hostsallow": "",
        "cifs_auxsmbconf": "",
        "cifs_browsable": "false",
        "cifs_comment": "",
        "cifs_default_permissions": "true",
        "cifs_guestok": "true",
        "cifs_guestonly": "true",
        "cifs_home": "false",
        "cifs_hostsdeny": "ALL",
        "cifs_recyclebin": "false",
        "cifs_ro": "false",
        "cifs_showhiddenfiles": "false",
    })
  )

print r.text
Glad it worked out for you.
 
Status
Not open for further replies.
Top