Installing on Linux Ubuntu / Debian:
Continue reading “Installing and configuring Samba”Tag Archives: NetBIOS
View and configure sharing of files and folders Windows from the command line
I will give an example of some commands for setting up sharing of resources.
View shared resources:
net share
Deleting a shared resource:
net share <sharename> /delete
Sharing a folder:
net share sharename=C:\dir
Example of disconnecting users from the share:
net session \\pc1 /delete
To close an open network file, use the command:
net file file_id /close
An example of granting user rights to a file (N – not set, W – write, C – change, F – full access):
cacls file.txt /G User:w
To cancel user access to a share:
cacls /R User
We allow up to 5 users to simultaneously connect to a shared resource:
net share sharename /users:5
Example of caching settings from a share (manual/BranchCache/documents/programs/none):
net share myshare /cache:manual
I want to note that when opening a share to a resource in the firewall, the following ports should be opened: TCP 139, TCP 445, UDP 137, UDP 138.
See also my articles:
Installing and using the nbtscan network scanner
Some information about the virus encryptor Trojan.Encoder.12544 attacked 06/27/2017
Installing and using the nbtscan network scanner
Install command in Linux Ubuntu/Debian:
sudo apt-get install nbtscan
The Windows version can be downloaded from http://www.unixwiz.net/tools/nbtscan.html
Network scan example:
nbtscan 192.168.1.0/24
I will describe the possible startup keys:
-O FILENAME (output information to file)
-v (more detailed information output)
-p (port indication)
-H (generate HTTP header)
-m (MAC address indication)
-n (do not convert names to DNS, display only IP)
-t NUMBER (response time in seconds, default 1)
-v (display version nbtscan)
Mikrotik SMB – file server configuration
I will use the Mikrotik RB951G-2HnD router as an example.
Connect the media to the USB router.
Let’s look at the status:
store disk print
Format it:
store disk format-drive 1
Reboot the router:
reboot
Add storage:
store add name=share disk=usb1 type=user-manager activate=yes comment="test"
Add share:
ip smb share add name=test max-sessions=15 directory=/test disabled=no comment="test share"
Example of disabling share:
ip smb share disable
Enabling smb:
enable smb
I will give examples of some commands:
ip smb print (view parameters)
ip smb set allow-guests yes/no (allows connection to guest users without entering a password, standard yes)
ip smb set comment TEXT (comment, standard MikrotikSMB)
ip smb set domain NAME (setting the name of the workgroup, standard MSHOME)
ip smb set enabled yes/no (SMB on/off, standard no)
ip smb set interfaces all/wlan1/bridge-local/… (installation of interfaces on which SMB will be started, standard all)
ip smb users add read-only=no name=LOGIN password=PASSWORD disabled=no (user creation)
ip smb users disable (disabling the user)
ip smb users enable (user activation)
ip smb users print (view the list of users)
ip smb users remove (deletion of the user)
ip smb users set read-only=no name=LOGIN password=PASSWORD (user change)
ip smb share enable
ip smb share print (view share list)
ip smb share remove
ip smb share set (changing the parameters of the share)
To get help, use the “?” character on the command line.
To go to the level above – “..”.
Example of configuring the firewall for smb:
add action=accept chain=input disabled=no dst-port=137-138 protocol=udp src-address-list=smb-allow add action=accept chain=input disabled=no dst-port=137,139 protocol=tcp src-address-list=smb-allow ip firewall address-list add address=1.1.1.1 disabled=no list=smb-allow
Official documentation:
wiki.mikrotik.com/wiki/Manual:IP/SMB
wiki.mikrotik.com/wiki/Manual:Store
You can also connect a hard drive to the router via the USB-SATA adapter.