Okay, xinetd wasn't a problem at all. I already had the configuration from playing around before, and it Just Worked. For those who might be interested:
xinetd is configured using two main files. /etc/services and /etc/xinetd.conf. If you inspect xinetd.conf, you'll notice that it includes /etc/xinetd.d/.
To have Samba start automatically when its required, first install xinetd.
Code:
# sudo apt-get install xinetd
Then create a new file called 'samba' in /etc/xinetd.d/ with the settings for Samba's service.
Code:
# sudo nano /etc/xinetd.d/samba
service netbios-ssn
{
port = 139
socket_type = stream
wait = no
only_from = 192.168.0.0
user = root
server = /usr/sbin/smbd
log_on_failure += USERID
disable = no
mdns = yes
instances = 1
}
only_from specifies what IP addresses are allowed to connect. 192.168.0.0 means anyone who's IP address starts with 192.168.
In my configuration, I haven't set up the NetBIOS daemon 'nmdb', as I don't need it. It would have to run all the time to function, so cannot be started with xinetd (as far as I know), and is technically obsolete anyway. I'm using avahi for my Mac.
You should also check that the ports are defined in the /etc/services file. I found that they already were for Ubuntu Server.
Code:
# grep -e 139 -e 445 /etc/services
netbios-ssn 139/tcp # NETBIOS session service
netbios-ssn 139/udp
microsoft-ds 445/tcp # Microsoft Naked CIFS
microsoft-ds 445/udp
You should see the first four lines, and they shouldn't have any characters before them (# or ; which comment out the line). If these lines are missing, add them using nano.
To ensure xinetd recognises the new configuration, restart it.
Code:
# sudo /etc/init.d/xinetd restart
Now try connecting to a share. In Windows, go to Start>Run and type \\192.168.2.3\ replacing the numbers with your server's IP address. Similarly for Linux, Mac OS et al: smb://192.168.2.3/
I hope someone will find this useful. I found this information liberally scattered across the Internet, so I've brought it together here.
Bookmarks