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