Reorder and clarify Samba setup instructions across recipes. Remove redundant "Configure Samba" section from install. Consolidate "Create Samba User" in install recipe. Relocate service verification to post-restart in configure recipe. Correct 'smbd --version' command.
77 lines
1.0 KiB
Markdown
77 lines
1.0 KiB
Markdown
# Install Samba
|
|
|
|
This recipe installs Samba on Ubuntu, enables the required services, and configures a basic file share.
|
|
|
|
## Install Packages
|
|
|
|
```bash
|
|
sudo apt update
|
|
sudo apt install -y samba
|
|
```
|
|
|
|
## Verify Installation
|
|
|
|
```bash
|
|
sudo smbd --version
|
|
```
|
|
|
|
Expected output:
|
|
|
|
```text
|
|
Version 4.x.x
|
|
```
|
|
|
|
## Enable Services
|
|
|
|
```bash
|
|
sudo systemctl enable smbd
|
|
sudo systemctl enable nmbd
|
|
sudo systemctl start smbd
|
|
sudo systemctl start nmbd
|
|
```
|
|
|
|
## Verify Services
|
|
|
|
```bash
|
|
systemctl status smbd --no-pager
|
|
systemctl status nmbd --no-pager
|
|
```
|
|
|
|
Both services should be reported as **active (running)**.
|
|
|
|
## Restart Samba
|
|
|
|
```bash
|
|
sudo systemctl restart smbd
|
|
sudo systemctl restart nmbd
|
|
```
|
|
|
|
## Configure Firewall (Optional)
|
|
|
|
If UFW is enabled:
|
|
|
|
```bash
|
|
sudo ufw allow samba
|
|
```
|
|
|
|
## Verify Listening Ports
|
|
|
|
```bash
|
|
sudo ss -tulpn | grep smb
|
|
```
|
|
|
|
Expected output should include ports **139** and **445**.
|
|
|
|
## Create Samba User
|
|
|
|
```bash
|
|
sudo smbpasswd -a <username>
|
|
sudo smbpasswd -e <username>
|
|
```
|
|
|
|
List configured Samba users.
|
|
|
|
```bash
|
|
sudo pdbedit -L
|
|
```
|