The FreeBSD Diary |
(TM) | Providing practical examples since 1998If you buy from Amazon USA, please support us by using this link. |
Samba - connecting FreeBSD to Microsoft
18 October 1998
|
The main page for Samba is http://www.samba.org/ You might also want to see the NFS article. NOTE: If you want to access Microsoft file systems from your FreeBSD box, you want Sharity-Light. |
18 October
|
Samba is a port which allows a FreeBSD box to share file systems with a
Microsoft box. Or the other way around depending on your point of view. The
man pages for Samba describe it as a LanManager like fileserver for UNIX.
To quote from The Complete FreeBSD by Greg Lehey:
|
5:22 pm - The install begins
|
The instructions for installation seem quite easy.cd /usr/ports/net/samba make install Let's see how it goes. It's downloading a 1.3 MB file for Samba version 1.98.18. Time for some food. |
5:48 pm - After the build
|
I own a copy of The Complete FreeBSD and it's one of the
books I recommend you buy. It's what I'm using to
install Samba. You will get more detail from that book than I have
supplied here. Samba can be run from startup or it can be run from inetd. I choose the later (see below, I changed my mind). Edit /etc/inetd.conf file. Near the bottom you should see two lines referring to Samba. Uncomment them. They look like this: netbios-ssn stream ....etc netbios-ns dgram ...etc Then either reboot or restart inetd by doing the following: kill -1 <pid> where pid is the process id of inetd as found by ps -auwx | grep inetd |
6:14 pm - Configuration
|
As the book says, Samba does not come with a configuration file. So I did the
following:cp /usr/ports/net/samba/work/samba-1.9.18p0/examples/simple/smb.conf /usr/local/etc Create a directory /var/log/samba and make it readable and writable only by root. Modify /usr/local/etc/smb.conf. Here's what I have in mine. Please note, not all of the file is shown here: [global] socket options = TCP_NODELAY printing = bsd printcap name = /etc/printcap load printers = yes guest account = guest[ftp] comment = ftp server file area path = /var/spool/ftp/pub read only = yes public = yes The key things to remember are:
|
6:54 pm - Testing the setup
|
To test the above connection, I did the following:bash-2.02$ smbclient \\\\freebsd\\ftp Added interface ip=10.0.0.1 bcast=10.0.0.255 nmask=255.255.255.0 Server time is Sun Oct 18 18:52:19 1998 Timezone is UTC+13.0 Password: Domain=[WORKGROUP] OS=[Unix] Server=[Samba 1.9.18p8] security=share smb: \> Note that I did not enter a password. It is a public service. I will write more about this later. |
19 October
|
You will notice above that the default domain is WORKGROUP. You may not want
that and may wish to consider adding the following line to the .conf file.
This example involves the TESTING domain.[global] workgroup = TESTING |
Changing the startup
|
I've decided to run samba from startup rather than from /etc/inetd.conf.
I'm doing this because I spotted a message in the mailing list archives which
suggested this was a good idea until things were stable. So here's what I did to
achieve that change.
echo " smbd" && /usr/local/sbin/smbd -D echo " nmbd" && /usr/local/sbin/nmbd -D I acutally stopped the existing copies of these program and restarted them from scratch. I think that's overkill, but so what. |
Getting SAMBA visible from Windows Explorer
|
With the above steps, you should be able to connect to your Samba server by
following these steps on your Windows machine:
If this doesn't work, I strongly urge you to follow the Samba diagnostics. I found them very useful. It is frequently difficult to find the DIAGNOSIS.TXT file referred to by so many SAMBA documents. It seems to move around the website. Hopefully this will settle down. I suggest trying the following in the order provided:
|
Getting SAMBA to appear under your workgroup
|
One of the good things about Samba, is that you can treat it like any other Windows
machine (as degrading as that may be to a FreeBSD box). In fact, what I liked seeing
was my FreeBSD box listed under Network Neighbourhood. Very nice! In order to do this, I think you need the following entries in /usr/local/etc/smb.conf. [global] remote announce = 10.0.0.255/WORKGROUP where 10.0.0.255 is the broadcast address for your subnet and WORKGROUP is the Windows domain or workgroup into which you wish the Samba services to be advertised. |
smb.conf
|
There are the entries from my Samba configuration file. They might help you.
Some things may have been changed for security reasons.[global] hosts allow = 10.0.0. workgroup = WORKGROUP socket options = TCP_NODELAY printing = bsd printcap name = /etc/printcap load printers = yes guest account = guest remote announce = 10.0.0.255/WORKGROUP security = share You should refer to man smb.conf for more information about these settings. |
NOTE: I'm told this hack is not needed. See the following section. When I first tried a Samba file service which was user specific, I found that connecting or browsing to that service resulted in the following error: no authority to log on from this station The full text of the message is available, but the solution has been extracted below for your convenience. Note that this is for NT 4 only.
NOTE: I've been told that recent versions of Samba avoid this problem with a configuration file setting. I've not tracked that down yet. Please refer to the following section for more information. |
Samba Authentication
5 July 2000
|
Back in late April, David Uhring wrote in with this information: I've got Samba running on Linux - still have to set it up on FreeBSD. The Windows registry hack is unnecessary. MS users logon to Windows, not NT Domain, using the same user names that appear in /etc/passwd and smbpasswd (wherever you have put it). They can then access their home directories and /tmp on the Samba server without further authentication. encrypt passwords = yes. The only share I haven't been able to get working properly yet is the printer share. My printer is an HP-812C which uses IEEE 1284 two-way communication and apparently the printer is not communicating back to the Windows boxes. Maybe if I use the HP-550C driver, this can be made to work. |
There have been many questions regarding the Samba login process. I
found something very interesting in the mailing list archives.
For those interested in the full text, the
original archive entry is available. The following is an extract from that
entry:
I also found virtually the same information at another site. Another archive message suggested adding "encrypt passwords = yes" to /etc/smb.conf . I have not tried that. |
Mounting NT drives
|
If you have an NT box which has a share on it, you can mount it from your FreeBSD box
using smbmount. But there's no reason why that share can't be on another
FreeBSD box. This sounds like it may be a good alternative to using
NFS. I've searched my system for smbmount, but can't find it.
I've found the source file, but I can't compile it. It appears that it is for Linux
only. I've asked a question on the mailing list. I'll report back later. It appears that the answer may be Sharity-Light, previously known as Rumba. |
Samba 2.0.6 - shares are printers
20 April 2000
|
Ernie Dunbar wrote in with this
bit about Samba 2.0.6 and printers:
|
Windows shared printer
5 July 2000
|
Adriel Ickler wrote in with this sharing a Windows printer:
|
Time server
31 December 2000
|
Lanny Baron wrote in to say that Samba can be your time server. Add
the following to your smb.conf file:
|
Interface Issues
11 April 2003
|
If you see the following types of error messages, then you probably haven't set the interfaces in the your samba configuration file.
If you see the above, look for a line like this in your configuration file and make sure it refers to a network interface card (NIC) which exists and has an IP address.
If you don't find a line like the above, perhaps you need to add it.
|
Can't get the mount?
28 September 2004
|
Today at work I was trying to get a Samba mount to work on my NT box. Only my machine could not mount.
The *nix box in question was not part of the Windows domain. The solution was to remove the entry for me
in We don't know why this solved the problem. Then, the mount would not resume upon login. I had to manually set it each time. The solution was to make my Samba password the same as my Windows password. Then it automagically mounted at each login. |