Samba fileserver

Author:

My brother had an old computer that he didn’t want anymore so he gave it to me. I bought a 500 GB SSD boot drive and a 4 TB mechanical hard drive for bulk storage. The intention was to use it to offload a lot of my documents and pictures. My mom is also known for taking a lot of photos and she pays for iCloud storage and I couldn’t let that continue haha.

I did this write up because I’m sure there’s many people out there who have a lot of data they want to Self host their data they may feel Intimidated setting up a linux server or they may not have heard of Samba before and I wanted to put all the information in one essay to follow guide I hope this helps.

Write-up

sudo apt update

sudo apt install samba

To install samba on Ubuntu. You will have to switch out apt install with something else depending on your distribution, but all other steps should work as far as I know.

sudo systemctl start smbd

sudo ufw allow samba

*This allows firewall traffic from samba

User account creation

first command to create the user second command to set the password.

Example

sudo useradd brad

sudo passwd brad

Use mkdir to make the directory of the Samba share.

mkdir /home/brad/samba/personal-smb

configuration

The configuration file for Samba in located  /etc/samba/smb.conf it is recommended to backup this

file in case anything breaks, to do this from the command.

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

Open the file in the text editor of your choice. I will be using nano.

sudo nano /etc/samba/smb.conf

Use your keys to scroll down to the bottom and paste this. Include the exact file path to the directory wish to share. Keep in mind that is case-sensitive.

Example

[personal folder]

path = /home/brad/samba/personal-smb

valid users = brad

browsable = yes

writable = yes

read only = no

save the file and restart Samba.

sudo systemctl restart smbd

File permissions

Set the file permissions for the shared folder sudo chmod -R 755 /home/brad/samba/personal-smb. This command will give you the ability to read, write and execute.

Share access

On Windows open your file Explorer in the address bar type your server’s IP address in between forward slashes.

Example \\192.168.1.11\

You may be prompted for your username and password that you created for the share. For easy access you can pin the folder to your start menu or taskbar.