README revision ed81dd52230eff1a7c7625caad21af232c36f6cb
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce# This file and its contents are supplied under the terms of the
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce# Common Development and Distribution License ("CDDL"), version 1.0.
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce# You may only use this file in accordance with the terms of version
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce# 1.0 of the CDDL.
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce# A full copy of the text of the CDDL should have accompanied this
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce# source. A copy of the CDDL is also available via the Internet at
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce# Copyright 2013 Nexenta Systems, Inc. All rights reserved.
225d845476b6136be9b77f528ed986bba7a7f732Simo SorceThis directory builds a program linking all of the SMB server code
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorceinto a user-level process. The result is not a fully functional
225d845476b6136be9b77f528ed986bba7a7f732Simo SorceSMB server but is very useful for some kinds of development work.
225d845476b6136be9b77f528ed986bba7a7f732Simo SorceThe architecture of this roughly parallels the in-kernel version,
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozekwhere the fksmbd program corresponds to the real smbd, the library
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorcelibfksmbsrv corresponds to the smbsrv kernel module, and all the
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorcerequired kernel interfaces are simulated in libfakekernel.
225d845476b6136be9b77f528ed986bba7a7f732Simo SorceJust as with the kernel code, there are mdb modules that know
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozekhow to walk data structures in libfksmbsrv, etc.
225d845476b6136be9b77f528ed986bba7a7f732Simo SorceFor debugging, etc. it's easiest to run this as a normal user,
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozeki.e. yourself (not root); but before you can do that, there are
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozeksome prerequisites to take care of:
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek a: Install ../bind-helper in /usr/lib/smbsrv/.
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek It needs to be either setuid root (easiest) or added to
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek the exec_attr as described in the top of bind-helper.c
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek (This must be in /usr/lib/smbsrv, not the proto area.)
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek b: Setup an SMB account for guest, i.e.
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek Add pam_smb_passwd.so.1 to pam.conf if not already there
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce (other password required pam_smb_passwd.so.1 nowarn)
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek % useradd guest
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek % smbadm enable-user guest
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek % passwd guest (sets the SMB p/w hash too)
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek Make sure guest shows in /var/smb/smbpasswd
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek c: chown/chmod the directories: /var/smb /var/run/smb
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina to yourself, mode 755. Reboot will chown these
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek back to root, so repeat this after a reboot.
225d845476b6136be9b77f528ed986bba7a7f732Simo SorceNow you can run fksmbd from the proto area using this script:
b011330c77168cdd864aaae54a75214935136c05Pavel ReichlYou can also run it under dbx (see the .dbxrc file).
b011330c77168cdd864aaae54a75214935136c05Pavel ReichlTo run it under mdb (with mdb modules build here):
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina mdb -L $ROOT/usr/lib/mdb/proc:/usr/lib/mdb/proc ...
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashovwhere ... is one of: fksmbd, core.nnn, -p $PID
a0d010f488bf15fb3e170ce04092013fa494401fPavel BřezinaThere are also some dtrace scripts in here, and in ../dtrace
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březinafor watching either all activity or only selected areas.
a0d010f488bf15fb3e170ce04092013fa494401fPavel BřezinaRun these like: dtrace -s Watch-all.d -p $PID -o output
a0d010f488bf15fb3e170ce04092013fa494401fPavel BřezinaThese two (from over in ../dtrace) also work with fksmbd:
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek dtrace -s smbd-authsvc.d -p `pgrep fksmbd` -o output
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov dtrace -s smbd-pipesvc.d -p `pgrep fksmbd` -o output
225d845476b6136be9b77f528ed986bba7a7f732Simo SorceHere are a couple simple, handy tests you can try:
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorcesmbclient -L localhost -U guest%guest
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorcesmbclient //localhost/test -U guest%guest -c dir
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorcesmbtorture //localhost/test -U guest%guest base