≡ Menu

How to disable File Sharing

In Windows, one can share files to other users in the same network using SMB protocol. We can disable sharing of a folder/drive from command prompt using net share command.

Open elevated windows command prompt and run the below command.

C:\>net share
Share name   Resource                        Remark
-------------------------------------------------------------------------------
C$           C:\                             Default share
IPC$                                         Remote IPC
ADMIN$       C:\WINDOWS                      Remote Admin
The command completed successfully.

To disable sharing C$, run the below command

C:\>net share C$ /DELETE
C$ was deleted successfully.

An alternative option is to disable file sharing on the computer. This disables sharing for all folders.

net stop lanmanserver

Example:

C:\>net stop lanmanserver
The following services are dependent on the Server service.
Stopping the Server service will also stop these services.

   Computer Browser

Do you want to continue this operation? (Y/N) [N]: y
The Computer Browser service is stopping...
The Computer Browser service was stopped successfully.

The Server service is stopping.
The Server service was stopped successfully.

Now if you list the network shares, you would get message that the server is not running.

C:\>net share
The Server service is not started.
Is it OK to start it? (Y/N) [Y]: n
C:\>
{ 0 comments… add one }

Leave a Comment