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