Dizwell Informatics

News from Nowhere

Mounting a Samba share on Solaris

1.0 Introduction

In a previous article, I’ve documented how you can create a share on a Solaris server that a Windows PC (or a Linux one, come to that) can then access freely, without authentication.

But suppose you want another Solaris server to access that share, too: how do you persuade a Solaris server to be a samba client as well as a server, in other words? And how do you tell Solaris to mount a samba share automatically at every boot?

In the Linux world, you’d take a trip to /etc/fstab to do all of this, but in the world of Solaris, you edit the /etc/vfstab instead. The extra “v” makes all the difference!

2.0 Mounting Samba Shares

As in the world of Linux, to mount anything in Solaris, automatically or not, you need a mount point ready to host the foreign file system. So let’s assume I have a server called bach which is samba-sharing a directory called bulkdata-b. On my second Solaris server, I would therefore do:

sudo -i                     # to become root
mkdir /bach                 # which is now my mount point
chown hjr:staff /bach       # I don't want special privileges on the mount point directory
chmod 777 /bach

I can then test-run how I’d mount it by issuing the command (as root):

mount -F smbfs // /bach
ls /bach
umount /bach

The directory listing at the end there should give you assurance that the contents of the samba share are visible and accessible. If they are not, you may need to enable the samba client service:

svcadm enable network/smb/client

…and then try again.

Once you are sure the thing works manually, as root you can add this line to /etc/vfstab:

//   -       /bach           smbfs   -       yes     rw,fileperms=0777,dirperms=0777

That’s all on one line, and you tab between each of the entries. The “-” items are entries, too, of a sort: they have to be there so that the line contains the right number of parameters, but the dash value is essentially the same as saying ‘not applicable’ for the relevant parameter.

With the modified /etc/vfstab saved, you can then:

mount /bach

…and it will mount the thing correctly for you, reading all the long-winded stuff we had to supply before from the vfstab file. Reboot your server, and you’ll find that the /bach directory is auto-mounted for you too (because that’s what the “yes” entry in the earlier vfstab line tells it to do).

Since the vfstab line also includes instructions to make the mounted share world-writeable, world-executable and world-readable (all those 0777’s have to mean something, after all!), you should find that as a non-root user, you can cd /bach and start creating, reading, editing and deleting files without any authentication requests at all -which suits me and my home network just fine. Your mileage might vary, of course!