To install Samba server, make sure that the following ports are open:
- TCP 139 and 445
- UDP ports 137 and 138
Here are the steps to install the Samba server:
- Install the Samba server with the following command:
$ sudo apt-get update $ sudo apt-get install samba -y
- After installation is complete, you can check the Samba version with the
following command:
$ smbd --version
- Next, we need to configure Samba to enable sharing on the network. First, create a
backup of the original configuration file:
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
- Next, open smb.conf and replace its contents with the following:
[global] workgroup = WORKGROUP server string = Samba Server netbios name = ubuntu security = user map to guest = bad user dns proxy = no [Public] path = /var/samba/shares/public browsable =yes writable = yes guest ok = yes read only = no create mask = 644
- Next, we need to create a shared directory:
$ sudo mkdir -p /var/samba/shares/public
- Change the directory permissions to make it world-writable:
$ sudo chmod 777 /var/samba/shares/public
- Restart the Samba service for the changes to take effect:
$ sudo service smbd restart