Skip to content
Search

Server Message Block

lastmod 2025-11-03created 2016-04-2912 edits

Server Message Block (SMB) is a message format used in DOS and Windows to share files, directories, and peripheral devices. NetBIOS is based on the SMB format, and many network products also use SMB. SMB-based networks include LAN Manager, Windows for Workgroups, Windows NT, and LAN Server. There are also many products that use SMB to allow file sharing between different operating systems. One of them is Samba, which lets Unix and Windows computers share directories and files.

SMB is mostly used on computers running Microsoft Windows. In the Microsoft environment, users usually know it simply as "Microsoft Windows Network".

When discussing Server Message Block (SMB), the following should be distinguished:

  • The SMB protocol
  • SMB services running on top of the protocol
  • NetBIOS
  • DCE/RPC services that use SMB as an authenticated inter-process communication channel (over named pipes)
  • The network browsing protocol, which mostly runs as a datagram service directly on top of the NetBIOS transport layer

Categories

  • smb4k - GUI client.
  • samba-client - Client.
  • cifs-utils - Needed for mounting.

curl download/upload

Download:

files=(
20230728000000_0000_CH04_041.smi
20230728000000_0000_CH04_042.avi
20230728000000_0000_CH04_042.smi
20230728000000_0000_CH04_043.avi
20230728000000_0000_CH04_043.smi
20230728000000_0000_CH04_044.avi
20230728000000_0000_CH04_044.smi
20230728000000_0000_CH04.avi
20230728000000_0000_CH04.smi
)

for i in ${files[@]}; do
  curl -u 'Windows\username:passwd' -O "smb://192.168.0.2/20tb_data/20230728/0000_000/$i"
done

Upload:

URL="smb://192.168.0.2/20tb_data/Videos/230727/Inference"
for i in ${files[@]}; do
  ## 주소 마지막에 업로드할 디렉토리가 아닌 업로드할 파일명까지 넣어야 한다.
  curl -T "$i" -u 'Windows/username:passwd' "$URL/$i"
done

Version with user input

#!/usr/bin/env bash

ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" || exit; pwd)

PREFIX="20tb_data/Models

read -r -e -i mynas -p "Please enter the host: " HOST
read -r -e -i "$USER" -p "Please enter the username: " USERNAME
read -r -s -p "Please enter the password: " PASSWORD

MODEL="rtmdet-ins_x_8xb16-300e_coco_2nd"
FILENAME="epoch_300.pth"
OUTPUT="rtmdet-ins_x_8xb16-300e_coco_2nd-epoch_300.pth"

curl -v -u "Windows\\${USERNAME}:${PASSWORD}" \
    -o "${OUTPUT}" \
    "smb://${HOST}/${PREFIX}/${MODEL}/${FILENAME}"

How to Mount on Linux

See cifs-utils for details.

See also

Network-attached storage (NAS)

Favorite site

author Zer0 sitemap