A Samba file server is a network-based file sharing solution that allows users to share files across multiple operating systems.
You can share files with other Windows and Mac users and access desktop files from a laptop using this software.
This article will walk you through the process of installing and configuring Samba on Ubuntu.
Installing Samba
To install Samba, we execute the following prompts:
sudo apt update
sudo apt install samba
We can ascertain if the installation was successful by executing the following command:
whereis samba
The following should be the output of the programme:
samba: /usr/sbin/samba /usr/lib/samba /etc/samba /usr/share/samba /usr/share/man/man7/samba.7.gz /usr/share/man/man8/samba.8.gz
Setting up Samba
Now that Samba has been installed, we need to create a directory for it to use as a sharing point:
mkdir /home/<username>/sambashare/
The command above creates a new folder named sambashare in our home directory, which we will use to transfer content later on in the process.
The Samba configuration file can be discovered at the following location: /etc/samba/smb.conf.
To add the new directory as a share, we ought to edit the file by running the following commands:
sudo nano /etc/samba/smb.conf
Towards the end of the document, insert the following lines:
[sambashare]
comment = Samba on Ubuntu
path = /home/username/sambashare
read only = no
browsable = yes
Then press the Ctrl-O key to save your work and the Ctrl-X key to exit the nano text editor.
What we’ve just tacked on is
- comment: A succinct description of the share.
- path: The location of our shared directory.
- only to be read:This directive has the effect of only granting permission to modify the contents of a shared folder when the value of the directive is no.
- The value “browsable” suggests that file managers such as Ubuntu’s default file manager will list this share under the “Network” category when the value is “yes” (it could also appear as browseable).
Now that we’ve established our new share, we’ll require to save it and restart Samba in order for it to be impactful:
sudo service smbd restart
Reconfigure the firewall rules to allow Samba traffic to pass through:
sudo ufw allow samba
Setting up User Accounts and Connecting to Share
As the system account password is not used by Samba, we must create a separate Samba password for our user account:
sudo smbpasswd -a username
It is important to note that the username entered must be associated with a system account in order for it to be saved.
Connecting to Share
Regarding Ubuntu:
Open the default file manager and select Connect to Server from the drop-down menu. Then type in the following:
smb://ip-address/sambashare
On Mac OS X, the following is true:
Select Go > Connect to Server from the Finder menu, and then enter the following information:
smb://ip-address/sambashare
Open File Manager on your virtual machine and modify the path to the file to:
\\ip-address\sambashare
Note that ip-address is the IP address of the Samba server, and sambashare is the name of the shared folder.
You’ll be prompted to enter your user credentials.
Connect with them by entering their information!
HelptoInstall offers Samba Installation Service at a low cost. Our Experts are available 24/7.