Samba
What is Samba?
- SMB/CIFS Protocol: Samba implements the Server Message Block (SMB) and Common Internet File System (CIFS) protocols used by Windows for file/printer sharing.
- Cross-Platform: Allows Linux, Unix, and macOS systems to share files and printers with Windows clients.
- Authentication: Supports Windows-style user authentication and access control.
- Integration: Can integrate with Windows domains, Active Directory, and NT4-style domains.
-
Server and Client Roles:
-
Samba Server: Shares files and printers for Windows/Linux clients.
- Samba Client: Accesses shared resources from Windows or other Samba servers.
-
Additional Tools:
-
smbclient: Command-line client to access SMB shares. smbd: The main daemon for sharing files and printers.nmbd: Handles NetBIOS name service for discovery on networks.winbind: Integrates Linux accounts with Windows accounts.
Installation
2. Basic Configuration
The main configuration file is:
- Global settings: Define workgroup, server name, logging, security.
- Share definitions: Specify directories to share and access permissions.
Example:
[global]
workgroup = WORKGROUP
server string = My Samba Server
security = user
[SharedDocs]
path = /srv/samba/shared
browseable = yes
read only = no
guest ok = yes
3. Create Samba User
- Adds and enables a Samba user. The username must exist on the Linux system.
4. Start and Enable Samba Services
smbd: File/printer sharing.nmbd: Network browsing (NetBIOS).
5. Accessing Samba Shares (Client)
- Using Linux:
- Mount a Samba share locally:
- Access from Windows: Open
\\server_ip\SharedDocsin File Explorer.
6. Common Commands
- List available shares on a server:
- Test configuration:
- Monitor connections:
Practical Use Cases
- File Sharing Across OSes: Share documents, media, or backups between Linux and Windows.
- Printer Sharing: Make Linux printers available to Windows clients.
- Home Networks: Central file repository for multiple devices.
- Enterprise: Integrate Linux servers into Active Directory environments.