Noob tries to set up samba

Greetings guys, I recently switched my server to debian 12, and one of my priorities has been setting up samba, so I can both copy files and folders to/from the server, and view/edit files stored in it. I’ve a folder mapped to a drive I want to be shared (so basically an entire drive is being shared to the lan), and I can view its contents just fine, as well as copy & delete stuff from that drive while accessing it from another pc in the network, be it windows or linux. My issue however is that it doesn’t seem the permissions are set correctly. Every file and folder I copy to the server’s drive seems to have “forbidden” permissions for everything.

Here’s an example of a random image and its properties, stored in my main pc:
Screenshot_2025-05-11_03-09-51
Screenshot_2025-05-11_03-10-01

And here’s the exact same file, copied over to my server, viewing its properties while it’s in the server’s drive (lovely name, I know):
Screenshot_2025-05-11_03-10-37
Screenshot_2025-05-11_03-10-45

I’ve set samba so that it asks me for a username and a password every time I want to browse the server’s files (I want to be the only one in my house able to access them), which works, but as you can see, something’s wrong with file and folder permissions, and I don’t know how can I solve it. I watched a few tutorials but to no avail. I’ll also link my server’s smb.conf file in case that gives you any ideas on what shall I do. Thanks in advance:

[global]
server string = Kuroba-XR
workgroup = WORKGROUP
security = user
name resolve order = bcast host

[Ass storage]
path = /media/Ass-storage
readonly = no
valid users = dank_vader
force user = dank_vader
force group = dank_vader
public = yes
writable = yes
1 Like

I’ll see if I can think of anything specific later, but I have notes on how I did a quick Samba server on Fedora.

I prefer vsftpd though; Windows and Linux I used FileZilla client.

1 Like

You need to add something like this to your shared folder:
create mask = 0700
directory mask = 0777

So with your example it could look like this:

[Ass storage]
path = /media/Ass-storage
readonly = no
valid users = dank_vader
force user = dank_vader
force group = dank_vader
public = yes
writable = yes
create mask = 0744
directory mask = 0777

I’ve tried 0754, 0755 and 0777 without avail. Maybe the numbers you suggest will do the trick? Either way I’ll try it and report back.

So I just tried setting masks, nothing different happened. Out of curiosity I tried accessing a file I coped from the server itself, and permissions there are just fine (here’s a screenshot of a file’s properties as seen from the server itself:)
Screenshot at 2025-05-11 20-39-06
I can read any copied files with no issues. So there must be something else related to the permissions themselves.

Over the years I have done serveral smb.conf by hand and dealing with permissions is a pain. I have discovered that the easiest way to do this is to run Cockpit with the 45Drives file sharing app installed. It’s so much easier to configure.

1 Like

word of advice, don’t ever expose such share to WAN (belive me I’ve tried) also Samba - ArchWiki

1 Like

Not planning to. This is just for my home network. If I want to access it from outside my house I use tailscale. I just need to sort this permission thing out xD

check firewalls, open ports, use phone to browse smb share (on android there is “Mix” app with good ui) listen to incoming traffic on server and read archwiki for smb toroughly

1 Like