How to break a Samba connection at server end?

How to break a Samba connection at server end?

Post by Charles Ji » Thu, 01 Nov 2001 09:21:14



I can see the connections to a samba server with 'smbstatus' or 'netstat'.

Because one connection from win98 has problem, I want to break it and connect
again. But how?

thanks,
charlie

 
 
 

How to break a Samba connection at server end?

Post by Dean Thompso » Thu, 01 Nov 2001 21:56:38


Hi!,

Quote:> I can see the connections to a samba server with 'smbstatus' or 'netstat'.

> Because one connection from win98 has problem, I want to break it and
> connect again. But how?

The * way is to find the SMB daemon which is responsible for handling the
connection with the win98 machine and terminating the daemon.  Additionally,
if you use the SWAT tool, you can disable/terminate sessions which are
connected to your system.

See ya

Dean Thompson

--
+____________________________+____________________________________________+

| Bach. Computing (Hons)     | ICQ     - 45191180                         |
| PhD Student                | Office  - <Off-Campus>                     |
| School Comp.Sci & Soft.Eng | Phone   - +61 3 9903 2787 (Gen. Office)    |
| MONASH (Caulfield Campus)  | Fax     - +61 3 9903 1077                  |
| Melbourne, Australia       |                                            |
+----------------------------+--------------------------------------------+

 
 
 

How to break a Samba connection at server end?

Post by Daniel McAlliste » Fri, 02 Nov 2001 04:12:38



Quote:> I can see the connections to a samba server with 'smbstatus' or 'netstat'.

> Because one connection from win98 has problem, I want to break it and
connect
> again. But how?

Charlie...
Let your "startup scripts" do the work for you.

Look in /etc/rc/init.d (or /etc/init.d -- one or both should work) and find
the file named smb (someone may have renamed it samba, but it should be just
smb). This file is the startup script for all of your SAMBA programs.
Assuming you have not mounted any CIFS "shares", all you'll need to do is
run this script with a "restart" option:

# /etc/init.d/smb restart

This will not only cause your existing connections to be cut (you're pulling
the daemon out from under them), but will also restart the services as well.
(Of course, if you want some delay before you restart, use:

# /etc/init.d/smb stop
... whatever else you want to do
# /etc/init.d/smb start

Hope this helps!

Dan McAllister

 
 
 

How to break a Samba connection at server end?

Post by Charles Ji » Fri, 02 Nov 2001 11:52:22


Thank you both for your kind explanations.

What I really want is killing a specific connection like that 'swat' can do. But
my 'swat' (port 901) has been disabled by security/firewall setting (I don't
know why, nor do I know how to recover it.).

- Further discovery: After I rebooted the two client win98 pc's, I found both
clients can not access samba server until I restart the samba. I dump further
info here for examination. If something's wrong, please tell me. Thank you.

(Before restart samba)
# smbstatus
    Samba version 2.2.1a
    Service      uid      gid      pid     machine
    ----------------------------------------------
    IPC$         nobody   nobody   19534   pc3      (192.168.0.3) Thu Nov  1
08:02:24 2001
    IPC$         nobody   nobody   19766   pc2      (192.168.0.2) Thu Nov  1
08:47:17 2001

    No locked files

# ./smb status
    smbd (pid 19766) is running...
    19534 (pid 1639) is running...
    nmbd (pid 1764) is running...
    1760 (pid ) is running...

(After restart samba)
# smbstatus
    Samba version 2.2.1a
    Service      uid      gid      pid     machine
    ----------------------------------------------
    jie          jie      keya     20214   pc2      (192.168.0.2) Thu Nov  1
09:42:47 2001
    IPC$         jie      keya     20207   pc3      (192.168.0.3) Thu Nov  1
09:41:44 2001
    jie          jie      keya     20207   pc3      (192.168.0.3) Thu Nov  1
09:44:33 2001
    IPC$         jie      keya     20214   pc2      (192.168.0.2) Thu Nov  1
09:42:47 2001

# ./smb status
    smbd (pid 20214) is running...
    20207 (pid 20168) is running...
    nmbd (pid 20179) is running...
    20178 (pid ) is running...

- Questions about the above:
    1. When win98 clients boot, they auto connect to samba with nobody and the
connection block a normal user (jie) from making his own connection. This looks
abnormal. I don't know how to fix though I've set "public=no" and "valid
user=jie" in smb.conf.
    2. I don't know what "the Service: IPC$" is. Can anyone tell me?
    3. I don't know why I have now two "smbd -D" and "nmbd -D", respectively. I
found them with "ps" and "./smb status". Is it OK?

thanks a lot,
charlie

--




>>I can see the connections to a samba server with 'smbstatus' or 'netstat'.

>>Because one connection from win98 has problem, I want to break it and

> connect

>>again. But how?

> Charlie...
> Let your "startup scripts" do the work for you.

> Look in /etc/rc/init.d (or /etc/init.d -- one or both should work) and find
> the file named smb (someone may have renamed it samba, but it should be just
> smb). This file is the startup script for all of your SAMBA programs.
> Assuming you have not mounted any CIFS "shares", all you'll need to do is
> run this script with a "restart" option:

> # /etc/init.d/smb restart

> This will not only cause your existing connections to be cut (you're pulling
> the daemon out from under them), but will also restart the services as well.
> (Of course, if you want some delay before you restart, use:

> # /etc/init.d/smb stop
> ... whatever else you want to do
> # /etc/init.d/smb start

> Hope this helps!

> Dan McAllister

 
 
 

How to break a Samba connection at server end?

Post by Daniel McAlliste » Sat, 03 Nov 2001 00:53:08



Quote:> Thank you both for your kind explanations.

> What I really want is killing a specific connection like that 'swat' can
do. But
> my 'swat' (port 901) has been disabled by security/firewall setting (I
don't
> know why, nor do I know how to recover it.).

I don't believe there is a way to do that in the current SAMBA... check out
the newsgroup linux.samba

Quote:> - Further discovery: After I rebooted the two client win98 pc's, I found
both
> clients can not access samba server until I restart the samba. I dump
further
> info here for examination. If something's wrong, please tell me. Thank

you.

<snip>
The obvious is that the user IDs have changed. Look at the "guest = " option
in your smb.conf file -- it appears you are looking for share-level access
anyway, so simply make the "guest" user be the RIGHT user for each share!

Quote:> - Questions about the above:
>     1. When win98 clients boot, they auto connect to samba with nobody and
the
> connection block a normal user (jie) from making his own connection. This
looks
> abnormal. I don't know how to fix though I've set "public=no" and "valid
> user=jie" in smb.conf.

This can easily be changed by telling Windoze 98 NOT to automagically
re-connect at reboot!

Quote:>     2. I don't know what "the Service: IPC$" is. Can anyone tell me?

This is simply a sign that the port in use is not registered in
/etc/services

Quote:>     3. I don't know why I have now two "smbd -D" and "nmbd -D",
respectively. I
> found them with "ps" and "./smb status". Is it OK?

Your smbd and nmbd daemons appear to be normal... and your cut/paste didn't
really show two separate daemons for each (unless I really missed
something)...

I think your problems have been as a result of ID conflict, not connection
or server process problems.

Hope this helps...

Dan McAllister