1767781057_maxresdefault.jpg

In this video, I go over how to setup samba for file sharing in Linux. This is a streamlined video that goes over the 2 easiest ways to accomplish this task.
Timestamps:
0:18 – Samba Share setup in Ubuntu GUI (nautilus)
2:25 – Terminal Setup – Smb.conf walkthrough
12:25 – Enabling SMB 1.0 in Windows
14:37 – Verifying Shares and Access

Below is my Samba Cheat-Sheet I created

Install Samba:
sudo apt install samba -y

Stop Samba Service:
sudo systemctl stop smbd

Create new directory to share:
mkdir linuxshare

Create New /etc/samba/smb.conf

In [global] tag add or change the folowing lines:
server role = standalone server
map to guest = bad user
usershare allow guests = yes
hosts allow = 192.168.0.0/16
hosts deny = 0.0.0.0/0

Add new tag at the end:
[linuxsharename]
comment = Open Linux Share
path = /home/titus/linuxshare
read only = no
guest ok = yes
force create mode = 0755
force user = titus
force group = titus

TEST SETTINGS Type: testparm

Restart Samba Service
sudo systemctl enable smbd
sudo systemctl start smbd

OPTIONAL: Allow samba through firewall
RHEL/Centos/Fedora
sudo firewall-cmd –add-service=samba

Debian/Ubuntu/Mint
sudo ufw allow Samba

Now on any Windows Machines enable windows feature “SMB 1.0” .

►► Digital Downloads ➜ https://www.cttstore.com
►► Patreon ➜ https://www.patreon.com/christitustech
►► Twitch ➜ https://www.twitch.tv/christitustech
►► Website and Guides ➜ https://christitus.com

source

41 thoughts on “How to setup Samba for File Sharing in Linux

  1. I was really hoping that this tutorial would help me network 2 linuxmint laptops. I followed the instructions – renaming the smb.conf that came with the installation and creating a new simple version. Added this in and restarted samba and adjusted the firewall. However the second laptop cannot see any shares on the first laptop.
    testparm does not report any warnings. I'm disappointed and a little frustrated and don't know where to go next. I guess that is sneakernet as they are on the same network in my house.

  2. I'm a newbie, and you're an expert, but I have read that you shouldn't do sudo gedit. sudo is for terminal commands. gedit is graphical. Apparently you are supposed to use gedit admin://

  3. It seems a few things have changed since this video came out. I was trying to use the file share in Linux Mint using Files and installed Nautilus as well. I keep getting permission errors. However doing it through the smb.conf file and all working. Crazy the GUI just doesn't work in LM anymore.

  4. I haven't tested it yet by accessing from Windows but if I try to access it from another Linux PC I get a prompt asking for credentials.

  5. I am trying to share a usb drive from Ubuntu to win11. I have setup the samba service and successfully shared a folder but I am stuck on the syntax for sharing the external usb drive.

  6. As this video is old, I had some issues. I found that commenting out the "force user" and "force workgroup" lines were necessary, and it worked.
    I also had to configure my default firewall in linux mint, as was described in the description of this video.

  7. I have gone through the cut and paste tutorial from Ubuntu and I am being limited to 100GB in my share is there a setting in my .conf I can change to expand into the full near TB of storage I have available? It is nice to see someone take the time to explain the terminal based implementations rather than the standard RTFM.

  8. Good job mate…thanks. Still learning Linux and loving it. Creating a network however, needs some simplifying from my vantage point. Sharing in windows is super easy and had no problems at all, but this Samba sharing has me jumping through that many darn hoops I dont know whether I am Arthur or Martha lol. Of course my interface is different from your older version, but I did manage to get all 3 of my boxes joined together on a semblance of a network (if you could call it that) and after giving preferences to just about every man and his dog, I can now view all boxes from every angle. Problem is… can't transfer folders from one to another (Permission denied) or edit a file that has been moved from one to another. Already balding and cant afford to pull any more hair out lol. Trying to see a funny side, but hard to do. Is there a way to give full permission without the 777 comand?

  9. obviously the tutorial works and I apricate that you are putting out things like this but there is a very bad flaw in the instructions. if you change the (guest ok = yes) to no then you will not be able to access the share because you are always logging in as guest because you forgot to set the samba password using sudo smbpasswd -a yourusername ; This will lead to the share being completely open to anyone on the network, and could lead to a horrible mess if a individual uses this and then takes their laptop to a coffee shop or if they set it up on a cooperate network. Be careful with these instructions.

  10. This is an old video but please don't enable SMB1.0, it's insecure, slow, obsolete and should not be used on newer OS. Add following line under [global] section in smb.conf instead: max protocol = SMB3. Or, if it doesn't work(for example, on Centos 6.x) try: max protocol = SMB2. If You have new enough(>= 4.2) Samba, do not add max protocol, it should work (and use SMB2 or SMB3) by default.

  11. I keep getting the error "Unable to access location – failed to mount Windows share: Invalid argument", no matter what. My server is a headless raspberry pi and my client is a Fedora, I didn't see any instructions for Linux clients yet, is there any difference?

  12. Thank you very much! You literally saved my day! I had done +2 hours trying to fix an issue and it was the SMB 1.0 feature that I didn't have enabled. Thanks!

  13. Many, many, many thanks for this simple setup that works. As you said it is RIDICULOUS how much info is out there that just complicates things or includes super advanced setups that only very few people use. I can finally share my external drives over my home network with this setup. Seriously you are a life saver.

  14. I have a ubuntu server 18.04 , file sharing is already enabled , but everyone can see others file kept in central server i want to make a centralised share folder where students can save their file in server with id password. Is this possible , pls suggest Thank you

  15. Not sure why, but this set up stopped working for me as of recently. I get this error "'net usershare' returned error 255: net usershare add: cannot convert name "Everyone" to a SID. The network responded incorrectly.." when I attempt to reshare my file locally. My smb.conf file is set up exactly as it is here. When I remove this file and use the default one, I am able to set up the share. Then I just run into the issue of trying to configure it so that I get it as another user on another computer in the network

  16. Fantastic!
    Many thanks for this excellent video, which has helped me solve a problem I've had for a while. Seems never trust the default smb.conf file. As a relatively new Linux user, I was avoiding editing the default file for fear of 'breaking' the system. Your approach worked perfectly!

  17. the files i create via the non-terminal method are discoverable on my windows machine but when they are created the are owned by "nobody". when i do the terminal method the file is not discoverable on the windows machine. bit confused really.

  18. Hello Chris… Do you have a video on how to join Active Directory from linux and authenticate samba users? Les´s say I only want the domainManagers_Group to be able to access my Samba Shares… Regards!!

  19. Not gonna lie, even a detailed video like this turns me off from Linux for servers. Im actually surprised its still this ridiculous to setup shared folders in linux… windows is literally 1 click and you've got yourself a server. Ive been using Linux mint as a daily driver for a couple years now. I really have no other use for windows besides servers since Linux is trash in that aspect.

Comments are closed.