From Bugzilla Helper: User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.2.19-6.2.1 i686) Description of problem: If root has a TMPDIR environment variable set when starting/restarting Samba, Samba will attempt to use that directory instead of /tmp for various things. If TMPDIR references anything other than a world-writable directory (e.g. TMPDIR=/root/tmp) then only users who have write privileges to TMPDIR can use Samba; others cannot even log in (for instance, if TMPDIR was /root/tmp when starting Samba, then only root can log in to Samba). If a TMPDIR variable exists but does not point to a valid directory, noone can use Samba, not even root. How reproducible: Always Steps to Reproduce: 1. log in as root 2. export TMPDIR=""; service smb restart 3. smbclient -L localhost # provide password when prompted Actual Results: Domain=[MYGROUP] OS=[Unix] Server=[Samba 2.0.8] tree connect failed: ERRSRV - ERRinvnetname (Invalid network name in tree connect.) Expected Results: a listing of Samba information, e.g. Domain=[MYGROUP] OS=[Unix] Server=[Samba 2.0.8] Sharename Type Comment --------- ---- ------- IPC$ IPC IPC Service (Samba Server) Additional info: Thanks go to Jonathan Marsden for noticing this. Samba uses mkstemp() when creating files inside the temp directory, which defaults to /tmp if TMPDIR was not set when Samba was started. So there is no danger in using /tmp. Anyone who wanted to use a different temp directory would want/need to edit /etc/rc.d/init.d/smb to set TMPDIR so that temp dir would be respected at boot time. I suggest that /etc/rc.d/init.d/smb ought to include a line that unsets TMPDIR so that Samba functions as intended, e.g. --- smb.rhat Tue May 8 00:25:59 2001 +++ smb Thu May 17 23:30:07 2001 @@ -24,6 +24,9 @@ RETVAL=0 +# set TMPDIR to a world-writable directory if you like +# (default is /tmp, and it is used safely) +unset TMPDIR start() { echo -n "Starting SMB services: "
Watch out about the mk(s)temp issues! Samba only uses any mkstemp in 2.2.0, and only finally kills mktemp in 2.2.1. The samba-team claims that all uses are checked, and I beleive them, but this should be noted.
Fixed in samba-2.2.0-2. Thanks for your report.