Sharing files between multiple computers on a local network can be a convenient way to access and transfer files. One way to do this is by setting up a Samba share on your Linux Mint system. Samba is an open-source implementation of the SMB/CIFS networking protocol that enables file and printer sharing between different operating systems, including Windows, Linux, and macOS.
In this tutorial, we’ll go through the steps of installing and configuring Samba on Linux Mint, creating a shared directory, setting up a Samba user with access to the shared directory, and finally connecting to the Samba share from a Windows 10 machine.
Installing Samba on Linux Mint
sudo apt-get install samba
This will download and install the Samba package and its dependencies.
Configuring Samba on Linux Mint
Once Samba is installed, we need to configure it by editing the smb.conf
file. This file is located in the /etc/samba/
directory.
To edit the smb.conf
file, open a terminal and run the following command:
sudo nano /etc/samba/smb.conf
In the [global]
section of the file, add the following lines:
map to guest = never
security = user
These settings disable guest access to the Samba share and require users to authenticate with a Samba user account.
Save and close the smb.conf
file by pressing Ctrl+X
, then Y
, then Enter
.
Creating a Shared Directory
The next step is to create a directory that will be shared with other computers on the network. You can choose any directory that you want, but it’s a good idea to create a directory specifically for sharing files.
To create a shared directory, open a terminal and run the following command:
sudo mkdir /home/myuser/share
Replace /home/myuser/share
with the path to the directory you want to share.
Setting Permissions on the Shared Directory
Before we can share the directory with Samba, we need to set the appropriate permissions on it.
To do this, open a terminal and run the following commands:
sudo chown myuser:sambashare /home/myuser/share
sudo chmod 770 /home/myuser/share
Replace myuser
with your username. sambashare
is the default group name for Samba.
Creating a Samba User
Now we need to create a Samba user account that will be used to authenticate access to the shared directory.
To create a Samba user, open a terminal and run the following command:
sudo smbpasswd -a myuser
Replace myuser
with your username. This will prompt you to enter a password for the Samba user. Choose a strong password and remember it, as you’ll need it later to connect to the Samba share from other computers.
Restarting the Samba Service
To apply the changes we’ve made to the Samba configuration, we need to restart the Samba service.
To do this, open a terminal and run the following command:
sudo systemctl restart smbd
Connecting to the Samba Share from Windows 10
Now that we’ve set up the Samba share on Linux Mint, let’s connect to it from a Windows 10 machine.
- On your Windows 10 machine, open File Explorer.
- In the address bar, enter
\\<ip-address-of-linux-mint-machine>
, replacing<ip-address-of-linux-mint-machine>
with the IP address of your Linux Mint machine. - If prompted, enter the username and password of the Samba user account you created earlier.
- You should now see the shared directory in the list of available folders. You can access the files in the shared directory just like you would any other folder on your Windows 10 machine.
Automatically Mapping a Drive to the Samba Share on System Startup
If you want to map a drive to the Samba share on system startup so that it’s available without having to manually connect every time, you can do so by following these steps:
- Open File Explorer on your Windows 10 machine.
- Click on the “Map network drive” button in the toolbar.
- In the “Drive” field, select a drive letter to use for the mapped drive.
- In the “Folder” field, enter
\\<ip-address-of-linux-mint-machine>\<name-of-shared-directory>
, replacing<ip-address-of-linux-mint-machine>
with the IP address of your Linux Mint machine and<name-of-shared-directory>
with the name of the shared directory you created earlier. - Check the box next to “Reconnect at sign-in“.
- Check the box next to “Connect using different credentials“.
- Click on the “Finish” button.
- When prompted, enter the username and password of the Samba user account you created earlier.
This will automatically map the shared directory to the selected drive letter on system startup, allowing you to easily access it from your Windows 10 machine without having to manually connect every time.
Conclusion
In this tutorial, we’ve shown you how to set up a Samba share on your Linux Mint machine, create a shared directory, set permissions, create a Samba user account, and connect to the Samba share from a Windows 10 machine. We’ve also shown you how to automatically map a drive to the Samba share on system startup for added convenience. With this knowledge, you should be able to easily share files between your Linux Mint and Windows 10 machines on your local network.
Leave a Reply