1.2 KiB
1.2 KiB
Install Samba
This recipe installs Samba on Ubuntu, enables the required services, and configures a basic file share.
Install Packages
sudo apt update
sudo apt install -y samba
Verify Installation
smbd --version
Expected output:
Version 4.x.x
Enable Services
sudo systemctl enable smbd
sudo systemctl enable nmbd
sudo systemctl start smbd
sudo systemctl start nmbd
Verify Services
systemctl status smbd --no-pager
systemctl status nmbd --no-pager
Both services should be reported as active (running).
Configure Samba
Replace the default configuration.
sudo cp smb.conf /etc/samba/smb.conf
Validate the configuration.
testparm
Expected output:
Loaded services file OK.
Restart Samba
sudo systemctl restart smbd
sudo systemctl restart nmbd
Configure Firewall (Optional)
If UFW is enabled:
sudo ufw allow samba
Verify Listening Ports
sudo ss -tulpn | grep smb
Expected output should include ports 139 and 445.
Create Samba User (Optional)
sudo smbpasswd -a <username>
sudo smbpasswd -e <username>
List configured Samba users.
sudo pdbedit -L