Re: [Samba] Questions about PDC with SAMBA

2009-02-12 Thread Vlastimil Šetka

Marcelo Opazo Vivallos:

Hi!

I have 8 subnets:
192.168.100.x/24
192.168.150.y/24
192.168.200.z/16
etc ...

Install a Primary Domain Controller (PDC), so that
users to perform authentication on the domain with its mounting
remote disks, among others. The network is correctly configured,
that is, the teams are perfectly by ping and the open
ports between the networks see no problems.

Notes:
- I disabled the multicast UDP in the route
- Add the lines in the smb.conf:
  - Hosts allow = 192.168.100. 192.168.150. 192.168.200. [..]
The others go right, because as I said it all works
this, but only for the subnet.
- Customers and resolve the server name netbios (wins OK)

However, I encountered only heard the PDC requests only
on its subnet (192.168.200.z).

* Questions:
- Why if the machines are visible between them they are not able to
hear the requests to the PDC?
- Is there another method instead of putting 8 samba servers in each subnet?


Reggard
Marcelo Opazo Vivallos
Chile
  
Hi. Try to use LMHOSTS file on Windows clients. We had problems when 
clients in some routed subnets can not reach the PDC sometimes even 
though the WINS was configured OK - and this helped us.

We are using this batch file on Windows:
echo 192.168.x.y PDC_NAME #PRE #DOM:DOMAIN  
%systemroot%\system32\drivers\etc\lmhosts
echo 192.168.x.y DOMAIN \0x1b #PRE  
%systemroot%\system32\drivers\etc\lmhosts

nbtstat -R

Replace PDC_NAME with netbions name of your PDC and DOMAIN with your 
domain name and 192.168.x.y with IP of the PDC. Length of record on the 
second line must be kept at 16 characters.


Vlastimil Setka
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] smb keeps stale connections from logged out users and shut down clients

2009-02-09 Thread Vlastimil Šetka

Volker Lendecke wrote:

On Mon, Feb 09, 2009 at 03:17:27PM +0100, Frederik wrote:

We are using Samba 3.0.33 as a PDC and file server for Windows XP
clients, but seem to be suffering lots of stale connections. smbstatus
still shows connections from users already logged out and even from
systems which have already been shut down.

Restarting the samba service, cleans up all stale connections.

We tried deadtime = 5 in the samba configuration file, but this does
not help at all.


The parameter keepalive doesn't help either?

Volker
We have similar problems with Samba 3.0.24 (Debian Etch) as PDC for ~120 
Win XP clients.


See also this thread refering about our problems:
 http://lists.samba.org/archive/samba/2008-September/143701.html

Since that time I made some investigations with interesting results.

About once per month it's a locking issue and the smbd proccess exists. 
It is

not a big problem. After Samba restart all is OK.

But other problem come up when logging smbstatus output every 10 seconds 
for audit purpose.
Wery often smbstatus shows a connected user from computer which have 
already been shut down

or from computer where other user is loged in (see referred thread).
This connections is showed usually for ~30 seconds and then disappear. I 
modified my logging
script: it also logs the proccess name of each PID in smbstatus. I found 
that PIDs of the
ghost connections is not the smbd! It's cron tasks, apache cgi scrips, 
... !


I patched smbstatus: normally it loads the sessionid.tdb database and 
checks if PID of
proccess in database exists. In my modification it also shows records 
with PIDs that

do not exist.

After a day after the Samba restart and ~400 domain logon/logoff there 
is about ~15
records with bad PID in the sessionid.tdb - with normal smbstatus this 
records are not

showed - only if the process with the PID coincidentally exists...

I think that Samba should have some self-healing mechanisms with 
sessionid.tdb. I can imagine
some garbage collector periodically checking existence of PIDs for all 
records in sessionid.tdb

and if such PID does not exists it should delete the record.
Have Samba such feature in newer versions, or is it other error?

Thanks.

Vlastimil Setka

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] samba server in two lans

2008-12-24 Thread Vlastimil Šetka

Mohammad Reza Hosseini napsal(a):

hello
we have a samba server on centos 5.2 and 2 different lans. so we gave the
server to ips eth0:172.16.93.217 and eth1: 192.168.89.3
but after this when we tried to join clients (windows xp) to the domain the
error: the specified domain either does not exist or could not be
contacted. what is the solution?
  
I had the same problem with Samba 3.0.24 - Debian Etch package. On PDC 
server with 5 interfaces (VLAN) when I tried to join clients to domain, 
sometimes I got several strange errors. Sometimes that errors came on at 
logon...


From tcpdump output I found a problem that Samba server sometimes send 
browse-reply UDP packets with source IP address of other interface than 
the outgoing interface. So the client can't locate PDC address.


This solution perfectly works for me:

smb.conf - global section:
  interfaces = 192.168.1.0/24 lo
  socket address = 192.168.1.5
where the 192.168.1.5/24 is address of one local interface. Be ware that 
now Samba can be reached only on this 1 address.


On the clients is required to set the LMHOSTS file, so client knows 
selected IP of PDC. I'm using this batch:
  echo 192.168.1.5 PDCNAME #PRE #DOM:DOMNAME  
%systemroot%\system32\drivers\etc\lmhosts

  REM keep length = 16 chars including the \0x1b
  echo 192.168.1.5 DOMNAME\0x1b #PRE  
%systemroot%\system32\drivers\etc\lmhosts

  REM reload config
  nbtstat -R

Maybe this issue is solved in some newer Samba version.

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


Re: [Samba] Closing sessions and smbstatus

2008-10-20 Thread Vlastimil Šetka



Hi,

When are client sessions closed?  


Let me explain what I'm trying to do...  we're in a School district and
we try to stop kids logging more than once.  They way I did this before
was to dump the active sessions from our previous Server2003 fileserver
into a file once a minute and process it with a Perl script to check who
was connected from where, rebooting machines remotely as needed!  This
work well enough with the odd 'hung' session causing minor problems.
  
I'm in exactly the same situation. The school, PDC for ~100 computers, 
hundreds of users.
We need to track the logon / logoff. I can't find any usable tools so I 
made my own system.
I found that most reliable is the smbstatus output. Windows do strange 
thinks with connections during domain logons so use of preexec script is 
complicated.
By the Perl script I run smbstatus every 5 seconds, scan the changes 
from previous run and write it to the MySQL DB. That's all woks fine.

So now I'm trying to do the same thing with our new Samba (3.0.31)
fileserver using the output from smbstatus.  However, in many cases
sessions are still in there long after the user has logged out of the
machine.  I'm even seeing two sessions for different people on the same
machine with the same pid number!  How is this working?  Why are not all
sessions ending when the user logs off?  Am I going to be able to use
this for what I'm trying to do?!!
  

I have some problems with this too. See this thread:
 [Samba] smbstatus - switched off computers are sometimes showed
 http://lists.samba.org/archive/samba/2008-September/143701.html

Now I get some new experience with it. The main problem is that samba 
sometimes doesn't update the sessionid.tdb file when the process exits. 
This records is not showed in smbstatus output, because smbstatus checks 
if the PID exists. I patched the smbstatus so it showed me that there is 
the records with no related PID. Then, maybe after 1 day or so, this PID 
is used for other proccess and I can see the ghost logon in my 
tracking system (and in most cases logoff at next run - after 5 seconds).
On the list is now the thread [Samba] processes not closing where is 
described some self-repair function related do sessionid.tdf file. The 
samba process when writing to this file should check all records and 
delete it if the PID doesn't exist. It will be nice but In my situation 
it doesn't work. Maybe it's because of Samba version (3.0.24, official 
Debian Etch package).


The most strange think I've seen is that I get some fake logon records 
for one user day-by-day at the same time. Let say [EMAIL PROTECTED] - tracked 
logon at tuesday 14:10:12, then at the same time at wednesday and 
thursday. In fact the COMP1 is switched off or other user is loged on at 
the time. The USER1 were loged on the COMP1 at monday.

The fileserver itself is working great, we have over 2000 users happily
using it with less problems than we had on the Windows box.  I really
appreciate all the work the Samba team does!
  
The same experience. Samba-based solution with one PDC is rock-stable 
for us in comparsion with several Windows 2003 AD servers running before.

Many thanks,

Steve Rippl
Woodland School District
  

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


Re: [Samba] Closing sessions and smbstatus

2008-10-20 Thread Vlastimil Šetka



But checking our server I find that the processes DO still exist!  So
I'm getting a user session in smbstatus with a specific PID and when I
ps -ef | grep PID there is the smbd process still running, yet the user
has long since logged out (days ago)?!  It's not just that the .tbd file
hasn't been updated, it's that the /usr/local/bin/smbd process is still
running.  A restart of Samba clears them all up immediately, but why are
they hanging around when the client is gone?  Is this just happening to
me on our particular setup or is this normal behavior?
  
We have ~400 logons per day. Sometimes (average 1 process per day) some 
processes hangs - the PID exists but user is several hours loged off. In 
this time other users were loged on this station... But there are some 
locked files connected with this PID - I think this is because the 
process isn'n closed.
Can you see some locked files connected with the bogus PID in smbstatus 
output?

Thanks.
  

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


Re: [Samba] smbstatus - switched off computers are sometimes showed

2008-09-20 Thread Vlastimil Šetka

Volker Lendecke wrote:

On Fri, Sep 19, 2008 at 10:02:02PM +0200, Vlastimil Šetka wrote:
 
I have a Samba server configured as PDC for ~100 computers. It's 
version 3.0.24 running on Debian Etch (distribution package).


I want to write a tool for user logon/logoff tracking. Because 
parsing log files is hard job (windows frequently disconnets or 
connects during user session or etc.) I decide to use smbstatus 
output which seem to be reliable.


So I run smbstatus binary every 10 seconds, parse the output and all 
is fine. But sometimes in the smbstatus output is show computer which 
is several hours switched off. At the next run (after 10s) this 
record is not presented. Sometimes this ghost record is shown for 
~30 seconds.


Does that smbd still exist? If computers are just switched
off then Samba might not notice.
  
I plan to check it but it's complicated because the ghost record is 
presented only for several seconds. I have to log the PID and related 
ps output.
Smbstatus checks if the proccess with the PID still exists. So if it's 
showed the smbd probably exists.
The computer is really switched off for several hours when this issue is 
presented. I also check the log file and there is no activity at this 
time. Today there were two ghost records for two different users on 
one computer - this computer is switched off for  24 hours and this two 
users were loged in during last 3 days.

Example:

11:10:21 - MACHINE1/USER1 - is in smbstatus
... constantly is in smbstatus
12:14:11 - MACHINE1/USER1 - is NOT in smbstatus
12:15:21 - MACHINE1/USER2 - is in smbstatus
...
12:45:31 - MACHINE1/USER2 - is NOT in smbstatus
Now the MACHINE1 is switched off.
18:16:21 - MACHINE1/USER1 - is in smbstatus !! (and the MACHINE1 is 
switched off several hours!)

18:16:31 - MACHINE1/USER1 - is NOT in smbstatus

Sometimes (cca twice a day) smbstatus return error output like this:
 tdb(/var/run/samba/sessionid.tdb): rec_read bad magic 0xd9fee666 at 
offset=116988


This is normal. Smbstatus reads the tdb files in read-only
mode. This implies no locking which in turn might lead to
smbstatus reading an inconsistent tdb file.
  
Yes. In sources I notice that no locking is used. Smbstatus only reads 
the file so it's OK. I also want to use INOTIFY on sessionid.tdb file 
but it's not usable because smbd has the file constantly open for write.
Volker   

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


Re: [Samba] Re: smbstatus - switched off computers are sometimes showed

2008-09-19 Thread Vlastimil Šetka

Avery Payne wrote:

Vlastimil Šetka wrote:
  

Sometimes (cca twice a day) smbstatus return error output like this:
 tdb(/var/run/samba/sessionid.tdb): rec_read bad magic 0xd9fee666 at
offset=116988


It looks like you have an issue with a record. Stop your service for a
moment, go in and cp your files in /var/run/samba to a new directory,
say to /var/run/samba.backup, then go into /var/run/samba and do this:

tdbbackup -sbak *.tdb
tdbbackup -v -sbak

...then start Samba.  The first makes a backup of your tdb tables; the
second verifies (and restores if needed) your tdb records.  This is
safe, but if there was any issue, you can always restore your files from
the copy in /var/run/samba.backup that you made.
  
At first: I get this error message only about twice a day (smbstatus is 
executed every 10 seconds) and the offset number every time changes. 
But the issue with a ghost user is more frequent.
I read the source of smbstatus and I think that delete 
/var/run/samba/sessionid.tdb will be enough. In my tool I use smbstatus 
-p and in this case any other file is not used.
I already tried to stop samba, delete this file and then start samba. 
New empty sessionid.tdb was created but nothing changes.
Maybe I will try your advice about delete and backup all tdb files but I 
have to wait for some time for testing when the system is not in use.

It's a bug or a feature and smbstatus is only informative? It's solved
in some newer version? Can you tell me about better source for connected
user status?


On RHEL52 here and just moved up to 3.0.28 as part of an update from
stock RHEL50.  Significant difference in stability and behavior from the
stock 3.0.25b.  Twice-a-week locking issues have just disappeared and
using the Computer Management tool attached to the Samba server shows
actual files open instead of ghost files.

Does apt-get update  apt-get upgrade show any entries for Samba?
  

The package is up-to-date Etch version.
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba