create CIFS share through shell / cli

Status
Not open for further replies.

hans2k6

Dabbler
Joined
Sep 23, 2013
Messages
17
Hi all,

does anyone knows how I can create cifs shares through the shell/ssh?
I have to create many of them so the web interface is took slow and it costs too much time.

I tried to add all shares to smb.conf, and it was working, but it was not shown by the web interface and after a reboot they were all gone.

Does anyone has a suggestion, how to do it?

THANKS
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
You probably changed /etc/local/smb.conf, which will not survive reboots.

In order to make persistent changes, you need to change /conf/base/etc/local/smb.conf
Note that you will have to mount the file system for read-write to perform this modification:
Code:
mount -uw /
 

Dusan

Guru
Joined
Jan 29, 2013
Messages
1,165
The shares are stored in the FreeNAS config file: /data/freenas-v1.db
The file is a SQLite3 database. You need to insert new rows into table sharing_cifs_share.
 

Dusan

Guru
Joined
Jan 29, 2013
Messages
1,165
In order to make persistent changes, you need to change /conf/base/etc/local/smb.conf
Note that you will have to mount the file system for read-write to perform this modification:
Code:
mount -uw /
This will still not make the shares appear in GUI (but I guess the shares will work). To see them in GUI you need to modify the config DB. If you change the DB, you must not modify smb.conf, as the FreeNAS backend will generate the proper entries.
 

hans2k6

Dabbler
Joined
Sep 23, 2013
Messages
17
This was also an idea form me. But when I opened the db there were only numbers in it (Sublime Text 3)
 

Dusan

Guru
Joined
Jan 29, 2013
Messages
1,165
It's a binary file, you can't edit it in text editor.
You need to either do SQL INSERT statements via /usr/local/bin/sqlite3, or you can download one of the SQLite GUI editors.
 
Status
Not open for further replies.
Top