How to close SMB session / Share / Connection using a "share" mechanism (IPC$) ?

etnbetnb 1 Reputation point
2021-01-30T07:03:29.127+00:00

This is more to answer than to ask, since I couldn't find an answer to that.

The situation I was faced with:
From File explorer, accessing a share on a Samba Host, that asked me to log in ( \home ).

After login, I have closed the browser and any open files.

The only connection left open was an IPC$ connection
( https://learn.microsoft.com/en-us/troubleshoot/windows-server/networking/inter-process-communication-share-null-session ).

PS C:\WINDOWS\system32> Get-SmbConnection  
  
ServerName ShareName    UserName Credential Dialect NumOpens  
---------- ---------    -------- ---------- ------- --------  
home      IPC$         ZZ\xx   ZZ\xx     3.1.1   1  

If I wanted to login to that Samba server again with another user (for the sake of ex.), I would have been logged back in using the first user authenticated earlier.

Only way I found around that was to restart the "Workstation" service, which will also close all other shares authenticated earlier, to some degree (mapped shares with users will reconnected).

Hope I am not misleading anyone, and I would suggest you test any side effects this solution will have on your overall system.

Windows for business Windows Client for IT Pros Networking Network connectivity and file sharing
Windows for business Windows Client for IT Pros User experience Other
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-02-01T07:38:49.197+00:00

    Hi ,

    As Gary said, use net use * /delete in cmd to clear current IPC$ connections.

    Next connect up with a different user:

    net use \\home\IPC$ /user:user1  
    

    that should prompt for password, if you want to enter it directly use this method:

    net use \\home\IPC$ /user:user1 user1spassword  
    

    For your reference:

    Switch Samba User with Net Use using IPC$

    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    Best Regards,

    Candy

    --------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.