		    SMB mounting in FreeBSD with SMB4K
                    ----------------------------------
                    $Id: README.FreeBSD,v 1.3 2004/05/21 12:32:47 shelton Exp $

1. Preface
----------

This document describes, how to coordinate SNB4K (initially Linux-only program)
and FreeBSD implementation of SMBFS. This document assumed, that you already
have working SMBFS in your kernel (see man mount_smbfs(8), FreeBSD Handbook
chapter 9 and an sample kernel config file part below:

#
# SMB/CIFS requester
# NETSMB enables support for SMB protocol, it requires LIBMCHAIN and LIBICONV
# options.
# NETSMBCRYPTO enables support for encrypted passwords.
options         NETSMB                  #SMB/CIFS requester
options         NETSMBCRYPTO            #encrypted password support for SMB

# mchain library. It can be either loaded as KLD or compiled into kernel
options         LIBMCHAIN               #mbuf management library
options         SMBFS                   #SMB/CIFS filesystem
# Kernel side iconv library
options         LIBICONV

You need all these for working SMBFS) and /etc/nsmb.conf configured properly
(in spite of that nsmb.conf has all variables 'transparent', documentation
about SMBFS tuning in FreeBSD are very, very shy :-( You should setup at least
paremeters "workgroup" and "nbns". As nbns you should set your WINS server
(as called it in Microsoft world).

2. After setup, but before first run
------------------------------------

So, you has just setup SMB4K. What should you do to properly mounting SMB
shares? You should do some things.

a. Remember, that SMB4K didn't mount shares itself. Instead of that, it
called 'smb4k_mount' with some set of parameters: server and share path in
//server/share format, mount point in /home/dir/dir2 format and parameters string,
as expected mount_smbfs. Also, SMB4K didn't umount shares itself. Instead of
this it called 'smb4k_umount' with single parameter - mount point.

b. Before start SMB4K first time, you should setup your .nsmbrc file
properly. For my pity, you must setup each Windows/Samba box in your network
SEPARATELY. No default usernames, no domain logons. Looks sadly, aren't you?
smb2nsmbrc script sligtly takes this job from you. You start smb2nsmbrc, it
called findsmb (of course, you should have findsmb and smbutil in your path),
parsing their output, asks you about username, password and stored file
.nsmbrctmp in current directory with pairs

[SERVERNAME:USERNAME]
password=<encrypted password>

Encryption done with smbutil and ready for use with mount_smbfs. Findsmb takes
your first network interface, so, when you have a box with some network cards,
start smb2nsmbrc with two parameters - network address and broadcast address.
These parameters will passed directly to findsmb. When .nsmbrctmp file already
exist it will added, not replaced! Simply add .nsmbrctmp content to your .nsmbrc
file in your home directory

c. You should have a 'sudo' package. SMB4K detect it and modify sudoers file

3. Inside running SMB4K
-----------------------

When you have done all previous steps properly (it looks quite difficult, but
PLEASE, do not ask me, ask SMBFS developers, why kernel-side support of SMBFS
in FreeBSD is extremely shy, undocumented and forgotten), you should see files in
mounted share, when you click on it in SMB4K window. When you see empty
directory (and really this directory keeps files), check these:

- You should have SMBFS in your kernel
- You should have propelry nsmb.conf
- You should have properly .nsmbrc (keep in mind - all server and user names
  in UPPER case!) with presented pairs [server:user] about EACH server and
  EACH user (so, when you have two logins alice and bob and two server alpha
  and beta, you should have 4 entries in .nsmbrc - [ALICE:ALPHA], [ALICE:BETA],
  [BOB:ALPHA] and [BOB:BETA]).

When all these has been done, but mount unsuccesful, try to mount this share
manually. Also you can uncomment string

echo $@ > /tmp/somefile

at start of smbmount script and looks, how passed a mount arguments in file
/tmp/somefile.

4. Feedback
-----------

All these scripts and this readme file were written by Rashid N. Achilov
(shelton@granch.ru). So, you can ask me about their working and also about
any other SMB shares mounting errors, but keep in mind - I'm NOT A SMBFS
DEVELOPER, I know nothing about internal technic of kernel-side support
of SMBFS under FreeBSD. To ask with serious problems, please mail to SMB developer:
Boris Popov <bp@freebsd.org>.
