xref: /illumos-gate/usr/src/cmd/smbsrv/fksmbd/README (revision ed81dd52)
1b819cea2SGordon Ross
2b819cea2SGordon Ross#
3b819cea2SGordon Ross# This file and its contents are supplied under the terms of the
4b819cea2SGordon Ross# Common Development and Distribution License ("CDDL"), version 1.0.
5b819cea2SGordon Ross# You may only use this file in accordance with the terms of version
6b819cea2SGordon Ross# 1.0 of the CDDL.
7b819cea2SGordon Ross#
8b819cea2SGordon Ross# A full copy of the text of the CDDL should have accompanied this
9b819cea2SGordon Ross# source.  A copy of the CDDL is also available via the Internet at
10b819cea2SGordon Ross# http://www.illumos.org/license/CDDL.
11b819cea2SGordon Ross#
12b819cea2SGordon Ross
13b819cea2SGordon Ross#
14b819cea2SGordon Ross# Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
15b819cea2SGordon Ross#
16b819cea2SGordon Ross
17b819cea2SGordon RossThis directory builds a program linking all of the SMB server code
18b819cea2SGordon Rossinto a user-level process.  The result is not a fully functional
19b819cea2SGordon RossSMB server but is very useful for some kinds of development work.
20b819cea2SGordon Ross
21b819cea2SGordon RossThe architecture of this roughly parallels the in-kernel version,
22b819cea2SGordon Rosswhere the fksmbd program corresponds to the real smbd, the library
23b819cea2SGordon Rosslibfksmbsrv corresponds to the smbsrv kernel module, and all the
24b819cea2SGordon Rossrequired kernel interfaces are simulated in libfakekernel.
25b819cea2SGordon Ross
26b819cea2SGordon RossJust as with the kernel code, there are mdb modules that know
27b819cea2SGordon Rosshow to walk data structures in libfksmbsrv, etc.
28b819cea2SGordon Ross
29b819cea2SGordon RossFor debugging, etc. it's easiest to run this as a normal user,
30b819cea2SGordon Rossi.e. yourself (not root); but before you can do that, there are
31b819cea2SGordon Rosssome prerequisites to take care of:
32b819cea2SGordon Ross
33b819cea2SGordon Ross  a: Install ../bind-helper in /usr/lib/smbsrv/.
34b819cea2SGordon Ross     It needs to be either setuid root (easiest) or added to
35b819cea2SGordon Ross     the exec_attr as described in the top of bind-helper.c
36b819cea2SGordon Ross     (This must be in /usr/lib/smbsrv, not the proto area.)
37b819cea2SGordon Ross
38b819cea2SGordon Ross  b: Setup an SMB account for guest, i.e.
39b819cea2SGordon Ross     Add pam_smb_passwd.so.1 to pam.conf if not already there
40b819cea2SGordon Ross     (other password required pam_smb_passwd.so.1 nowarn)
41b819cea2SGordon Ross     % useradd guest
42b819cea2SGordon Ross     % smbadm enable-user guest
43b819cea2SGordon Ross     % passwd guest    (sets the SMB p/w hash too)
44b819cea2SGordon Ross     Make sure guest shows in /var/smb/smbpasswd
45b819cea2SGordon Ross
46b819cea2SGordon Ross  c: chown/chmod the directories: /var/smb /var/run/smb
47b819cea2SGordon Ross     to yourself, mode 755.  Reboot will chown these
48b819cea2SGordon Ross     back to root, so repeat this after a reboot.
49b819cea2SGordon Ross
50b819cea2SGordon RossNow you can run fksmbd from the proto area using this script:
51b819cea2SGordon Ross  ./Run.sh -df
52b819cea2SGordon Ross
53b819cea2SGordon RossYou can also run it under dbx (see the .dbxrc file).
54b819cea2SGordon RossTo run it under mdb (with mdb modules build here):
55b819cea2SGordon Ross  mdb -L $ROOT/usr/lib/mdb/proc:/usr/lib/mdb/proc ...
56b819cea2SGordon Rosswhere ... is one of: fksmbd, core.nnn, -p $PID
57b819cea2SGordon Ross
58*ed81dd52SAlek PinchukThere are also some dtrace scripts in here, and in ../dtrace
59*ed81dd52SAlek Pinchukfor watching either all activity or only selected areas.
60b819cea2SGordon RossRun these like:  dtrace -s Watch-all.d -p $PID -o output
61b819cea2SGordon Ross
62*ed81dd52SAlek PinchukThese two (from over in ../dtrace) also work with fksmbd:
63*ed81dd52SAlek Pinchuk	dtrace -s smbd-authsvc.d -p `pgrep fksmbd`  -o output
64*ed81dd52SAlek Pinchuk	dtrace -s smbd-pipesvc.d -p `pgrep fksmbd`  -o output
65*ed81dd52SAlek Pinchuk
66b819cea2SGordon Ross
67b819cea2SGordon RossHere are a couple simple, handy tests you can try:
68b819cea2SGordon Ross
69b819cea2SGordon Rosssmbclient -L localhost -U guest%guest
70b819cea2SGordon Ross
71b819cea2SGordon Rosssmbclient //localhost/test -U guest%guest -c dir
72b819cea2SGordon Ross
73b819cea2SGordon Rosssmbtorture //localhost/test -U guest%guest base
74