Samba server set up so it works with both linux and windows computers
To install Samba, run the following commands:
sudo apt update
sudo apt install samba
To verify the installation, you can check the location of the Samba binaries:
whereis samba
Expected output should include paths like /usr/sbin/samba
, /etc/samba, etc
.
Now that Samba is installed, create a directory for sharing:
mkdir /home/<username>/sambashare/
Edit the Samba configuration file to add the new directory as a share:
sudo vim /etc/samba/smb.conf
or
sudo nano /etc/samba/smb.conf
Add the following lines at the bottom of the file:
[sambashare]
comment = Samba on Ubuntu
path = /home/<username>/sambashare
read only = no
browsable = yes
If using vim
Save and exit : ESC
-> :wq!
If using nano
Save the file (Ctrl-O, Enter)
and exit (Ctrl-X)
nano.
Restart the Samba service for the changes to take effect:
sudo service smbd restart
Update the firewall rules to allow Samba traffic:
sudo ufw allow samba
Since Samba uses its own user authentication, set a Samba password for your user account:
sudo smbpasswd -a <username>
Note: The username must correspond to a system account; otherwise, it will not be saved. For example, the path /home/<username>/sambashare
should reflect an existing system user.
Open the file manager, click Connect to Server, and enter:
smb://<ip-address>/sambashare
Replace <ip-address>
with the IP address of your Samba server and sambashare with the name of your share.
In Finder, go to Go > Connect to Server and enter:
smb://<ip-address>/sambashare
Replace <ip-address>
with the IP address of your Samba server and sambashare with the name of your share.
Open File Explorer and enter the following in the address bar:
\\<ip-address>\sambashare
Replace <ip-address>
with the IP address of your Samba server and sambashare with the name of your share.
When trying to connect we kept getting the followiung error :
To solve this we had to go on Windows Registry and make some small changes. Please execute the following instructions:
Window + r : regedit
go to the following location:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\
Add new DWORD:
Key: LmCompatibilityLevel
Value: 4
https://ubuntu.com/tutorials/install-and-configure-samba#1-overview
https://serverfault.com/questions/744312/access-denied-to-samba-share-from-windows-10