Mounting SMB/CIFS shares in OpenBSD
Found how just some minutes ago. I was preparing a backup solution for a windows-based network using OpenBSD and rdiff-backup. The idea is very simple:
Some windows workstations store some data into a windows (or unix+samba) file server. The data needs to be backed up, just in case. All the information we will backup regularly are the user profiles and a backup directory shared through the whole network (so everyone could put in there everything they need to backup).
As those shares/folders/directories are exported using the SMB/CIFS protocol, I can mount them in the OpenBSD host using sharity-light, an userland implementation of smbfs (which operates in kernel space).
To mount a windows share using sharity-light, you only need an empty directory on your filesystem and do something like:
# shlight //windowsserver/backup /mnt/backup -U windows_user -P someuglypassword #
NOTE: here windowsserver is a name pointing to the ip address of the windows server, while windows_user and someuglypassword are the user credentials needed to access (in this case) the backup share.
NOTE2: sharity does not allow ip addresses as the server name, and it will fail if you try to use the server.domain.ext naming convention, so you will probably need to add something like that to your /etc/hosts file:
192.168.1.111 windowsserver.mydomain.net windowsserver
After using calling the shlight script, you will be able to access the windows share just as any other mounted file system in OpenBSD:
# df -h Filesystem Size Used Avail Capacity Mounted on [ ... ] shlight-31463 298G 93.8G 204G 31% /mnt/backup
In my case, now I can safety run rdiff-backup to create an easy-to-recover full backup (with incrementals) on my local filesystem.