pantz.org banner
OpenBSD and Samba mounts
Posted on 09-30-2012 22:18:49 UTC | Updated on 09-30-2012 22:52:52 UTC
Section: /software/samba/ | Permanent Link

I wanted to mount some files from a remote Linux box on my OpenBSD firewall. I would have loved to have used sshfs as it would have made everything quick and painless, but from all my searching there is no sshfs module for fuse on OpenBSD. If someone knows this not to be true hit up my "About" section, grab my email address and set me straight. The next idea was using NFS as I know OpenBSD supports NFS and so does Linux. Then I thought about dealing with the portmapper and firewalls and I did not want to deal with opening ranges of ports for NFS. I finally settled on using Samba. 4 ports and we are done. Plus even windows clients can use it if need be.

Setup Samba on Linux

Since I have Ubuntu for my Linux box I just did an "sudo apt-get install samba" and that quickly installed Samba. I had made a very simple smb.conf file that I dropped in /etc/samba/smb.conf (see below). After that I started Samba with "service smbd start". Then I opened ports 137,138,139 and 445 on my Linux boxes firewall. Here is the simple read only config for my Samba share.

[global]
workgroup = workgroup
netbios name = linuxhost 
security = share
#interfaces = 127.0.0.0/8 lo
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
#bind interfaces only = true

[share1]
comment = Samba Share
path = /path/to/share
read only = Yes
guest only = Yes
#writeable = Yes
guest ok = yes
create mask = 0755

The Samba config is set to read only so no worries about people deleting your files. I left some lines commented out for notes to myself. If you do need write access then this config gets a little more complicated and that is not what is intended for this blog post.

Mounting Samba shares on OpenBSD

After getting the Linux Samba share configured and exported I now needed to mount it on the OpenBSD box. To do this in OpenBSD there is a program called sharity-light. It is available from OpenBSD packages. I switched to a root account and installed sharity-light with "pkg_add -i sharity-light" (remember to set your PKG_PATH env var to get this to work). Then I made a dir where the share was going to be mounted "mkdir /tmp/share". Lastly mounted the share from the Linux box with "shlight //linuxhost/share1/ /tmp/share -U guest".The share will then ask you for a password. Since this is a guest account there is none so just hit enter. Your files should now appear on your OpenBSD machines mount point.

Problems

I did have one problem with permissions on the Linux box hosting the files. You need to make sure all the files permissions are open enough for the mount point to access the files. The easiest way to do this is to make sure the files your sharing are chmod'ed to 755. This will allow the owner of the files on the Linux box to still be able to write to them and the group and global permissions will be readable and executable. Remember you need directories to have execute on for an account to be able to get into it. So if you keep getting "Permission Denied" when trying to copy a file check on the local file permissions and the remote file perms.

Reddit!

Related stories


RSS Feed RSS feed logo

About


3com

3ware

alsa

alsactl

alsamixer

amd

android

apache

areca

arm

ati

auditd

awk

badblocks

bash

bind

bios

bonnie

cable

carp

cat5

cdrom

cellphone

centos

chart

chrome

chromebook

cifs

cisco

cloudera

comcast

commands

comodo

compiz-fusion

corsair

cpufreq

cpufrequtils

cpuspeed

cron

crontab

crossover

cu

cups

cvs

database

dbus

dd

dd_rescue

ddclient

debian

decimal

dhclient

dhcp

diagnostic

diskexplorer

disks

dkim

dns

dos

dovecot

drac

dsniff

dvdauthor

e-mail

echo

editor

emerald

encryption

ethernet

expect

ext3

ext4

fat32

fedora

fetchmail

fiber

filesystems

firefox

firewall

flac

flexlm

floppy

flowtools

fonts

format

freebsd

ftp

gdm

gmail

gnome

google

gpg

greasemonkey

greylisting

growisofs

grub

hacking

hadoop

harddrive

hba

hex

hfsc

html

html5

http

https

hulu

idl

ie

ilo

intel

ios

iperf

ipmi

iptables

ipv6

irix

javascript

kde

kernel

kickstart

kmail

kprinter

krecord

kubuntu

kvm

lame

ldap

linux

logfile

lp

lpq

lpr

maradns

matlab

memory

mencoder

mhdd

mkinitrd

mkisofs

moinmoin

motherboard

mouse

movemail

mplayer

multitail

mutt

myodbc

mysql

mythtv

nagios

nameserver

netflix

netflow

nginx

nic

ntfs

ntp

nvidia

odbc

openbsd

openntpd

openoffice

openssh

openssl

openvpn

opteron

parted

partimage

patch

perl

pf

pfflowd

pfsync

photorec

php

pop3

pop3s

ports

postfix

power

procmail

proftpd

proxy

pulseaudio

putty

pxe

python

qemu

r-studio

raid

recovery

redhat

router

rpc

rsync

ruby

saltstack

samba

schedule

screen

scsi

seagate

seatools

sed

sendmail

sgi

shell

siw

smtp

snort

solaris

soundcard

sox

spam

spamd

spf

spotify

sql

sqlite

squid

srs

ssh

ssh.com

ssl

su

subnet

subversion

sudo

sun

supermicro

switches

symbols

syslinux

syslog

systemd

systemrescuecd

t1

tcpip

tcpwrappers

telnet

terminal

testdisk

tftp

thttpd

thunderbird

timezone

ting

tls

tools

tr

trac

tuning

tunnel

ubuntu

unbound

vi

vpn

wget

wiki

windows

windowsxp

wireless

wpa_supplicant

x

xauth

xfree86

xfs

xinearama

xmms

youtube

zdump

zeromq

zic

zlib