Personal Privacy

Login Advanced Search
     General TopicsSelf Hosted ServicesServer Setup

File Sharing with Samba

Introduction

SAMBA is a way to share files and folders with multiple devices using various operating systems. Using SAMBA you can share a hard drive with everyone in your house and easily access its data.

Installation and Set Up

Install SAMBA on Ubuntu using:

sudo apt-get -y install samba

Next, we need to create the folder we need to share and set its access. Here, we assume that the folder will be located at /mnt

.
sudo mkdir /mnt/share

Next, we need to configure SAMBA:

sudo nano /etc/samba/smb.conf

Go to the end of the file, and paste this:

[fileshare]
path = /mnt/shared
writable = yes
valid users = username
create mode = 0770
directory mode = 0770

Here, [fileshare] is an arbitrary name which will be used later when connecting to the folder from other devices. Also, do not forget to change username to your actual Ubuntu username. Enable and restart the service:

sudo systemctl enable smbd
sudo systemctl restart smbd

Finally, change the firewall settings:

sudo ufw allow 139/tcp
sudo ufw allow 445/tcp
sudo ufw disable && sudo ufw enable

Next, we need to add our user as a SMABA user and create a password.

sudo smbpasswd -a

Accessing SMABA from a Windows Client

Accessing your shared folder is very easy. On a computer connected to the same network, go to This PC. On the File menu, click on Map network drive. In Folder field,add the IP address of your server followed by the name you chose in /etc/samba/smb.conf (here it was fileshare) in this format:

\\192.168.1.2\fileshare

Check Connect using different credentials and click Finish. A window will pop up and ask for the username and password which you need to use your Ubuntu credentials here. If everything is correct, you should have your shared folder available!

Buy me a coffe?!


Comments

No comments yet!
Add a new comment:

8