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