Dizwell Informatics

News from Nowhere

Create a Samba Share on Solaris 11

The requirement is to create a share on a Solaris 11 server which is freely accessible to anyone logging on from a Windows PC -there are no security requirements, so any user should be able to read, write and delete anything within the share.

The share will be of a zpool which has already been created using the command:

zpool create -f safedata raidz c2d0 c2d1 c3d0 c3d1

Those happen to be the device ids for the disks in my HP Gen8 Proliant microserver. In that zpool, I also create a dataset, like so:

zfs create safedata/bulkdata

So it is then the bulkdata “directory” that needs to be shared via Samba.

That is done, as root, with this sequence of commands:

pkg install service/file-system/smb
zfs set share=name=bulkdata,path=/safedata/bulkdata,prot=smb,guestok=true safedata/bulkdata
zfs get sharesmb safedata/bulkdata
zfs set sharesmb=on safedata/bulkdata
svcadm enable -r smb/server
svcs -a | grep smb
chmod 777 /safedata/bulkdata

The first command installs the necessary Samba software, if it’s not been installed already.

The second command is where all the hard work is done: it specifies the path to be shared; says it should be shared using the smb protocol; and that it’s ok for guests to access it (and thus password-less access will be fine).

The third command shows you the state of your share. You should see a response similar to this:

root@rvw:~# zfs get sharesmb safedata/bulkdata
safedata/bulkdata    share.smb  off    local

Notice how the share, whilst it exists, is currently turned “off”. Fixing that is what the fourth command does, and if you re-execute the third command after you’ve set the sharesmb property to have a value of ‘on’, that’s what you should see in the third column of the output.

The final commands just verify that the Samba service is on and sharing things appropriately; whilst the last chmod command just makes sure that everyone who wants to, can read and write the contents of the new share.

By default, Solaris shares its Samba out as part of a workgroup called, imaginitively enough, ‘WORKGROUP’. Chances are you will want to change that to something more meaningful. It’s easily do-able (as root) with this command:

smbadm join -w dizwell

That will respond like so:

root@bach:~# smbadm join -w dizwell
After joining dizwell the smb service will be restarted automatically.
Would you like to continue? [no]: yes
Successfully joined dizwell

Just agree to ‘join dizwell’ (or whatever workgroup name you’ve mentioned, of course) and then you’re in business.