97 lines
1.2 KiB
Markdown
97 lines
1.2 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
|
|
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)**.
|
|
|
|
## Configure Samba
|
|
|
|
Replace the default configuration.
|
|
|
|
```bash
|
|
sudo cp smb.conf /etc/samba/smb.conf
|
|
```
|
|
|
|
Validate the configuration.
|
|
|
|
```bash
|
|
testparm
|
|
```
|
|
|
|
Expected output:
|
|
|
|
```text
|
|
Loaded services file OK.
|
|
```
|
|
|
|
## 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 (Optional)
|
|
|
|
```bash
|
|
sudo smbpasswd -a <username>
|
|
sudo smbpasswd -e <username>
|
|
```
|
|
|
|
List configured Samba users.
|
|
|
|
```bash
|
|
sudo pdbedit -L
|
|
```
|