Hello beautiful peoples!
Today I will show You how to configure Ubuntu 22.04 LTS with Samba (SMB) share that’s read and write capable.
Wait wait wait? What are you talking about one might ask. Ok ok… Bit of information for you…
Server Message Block (SMB) is a network communication protocol that allows computers to share files, printers, and other resources over a network. It was originally developed by IBM in 1983 and later adopted by Microsoft. SMB is mainly used by Windows computers, but it can also be used by other operating systems such as Linux.
Samba is an open-source implementation of the SMB protocol that allows Linux servers to communicate with Windows clients. The smbd daemon is a part of Samba that provides file sharing and printing services to Windows clients using the SMB protocol. It allows Linux servers to share files and printers with Windows clients in the same way that Windows servers do.
Setting up a Linux server with smbd can be useful if you have a mixed network of Windows and Linux computers and you want to share files and printers between them. For example, if you have a Linux server that stores files that need to be accessed by Windows clients, you can use smbd to share those files with the Windows clients. Similarly, if you have a printer connected to a Linux server that needs to be accessed by Windows clients, you can use smbd to share that printer with the Windows clients.
Comprende Amigo? Bueno…
So after initial setup of Ubuntu I’ve decided to get the file sharing going. Those are the few commands that I’ve used to do it:
sudo apt -y update
sudo apt -y upgrade
sudo apt -y install samba
mkdir ~/Shared/
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.original.backup
cd /etc/samba/
sudo wget -c https://files.andrzej.langow.ski/smb.conf
sudo chmod 777 /etc/samba/
sudo chmod 777 /etc/samba/smb.conf
sed -i "s/CHANGEME/$(whoami)/g" /etc/samba/smb.conf
sudo chown -Rf root:root /etc/samba/smb.conf
sudo chmod 755 /etc/samba/
sudo chmod 644 /etc/samba/smb.conf
In the next command replace YOURUSERNAME with Your actual username. You can find out what Your username is by running this command as user:
whoami
sudo smbpasswd -a YOURUSERNAME
Now create a password that Your user will use to log in to the samba share and press ENTER.
Confirm the password and press ENTER again.
sudo systemctl enable smbd
sudo systemctl restart smbd
Now figure out what IP and hostname is:
ip a | grep inet
hostname
You can then use either to open connection to the samba share by typing:
\\192.168.1.133
or \\hostname (doesn’t always work)
\\ubuntu
in Windows Explorer address bar. And then log in using the correct credentials.
And… Voila…
And if You try and create a folder in Your “Shared” catalog – You will see that its read / write capable!
Read / write capable Samba server at Your network tips.
I hope this helps!
Catch you on the flip side,
AndrzejL