Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Samba: how to lock file in use

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
gi4mpy
Posts: 7
Joined: 2017-12-22 10:24

Samba: how to lock file in use

#1 Post by gi4mpy »

Hello fellows,

This is my first request so let me a few introduction: I'm Davide from Italy and living in Spain right now. I've been working as sys admin during 2 years...4 years ago! Last version of Debian I've worked was Lenny. Now I'm working for a web agency as web developer and I started to propose some internal improvements: configure the server we have for basic needs, and first of all SAMBA.

I already installed Debian 9 and configured basics network stuff, installed Samba, created users and everything is working fine..but most important issue is to prevent anyone from opening a file in use, and seems it's not working/set.

I tried with a PSD and my mate did the same with that file, but it wasn't flag as locked.

Any suggestions? I Googled with different terms but nothing..

Thanks in advance to the community:)

User avatar
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Re: Samba: how to lock file in use

#2 Post by acewiza »

You might have better luck here: https://www.samba.org/
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

User avatar
4D696B65
Site admin
Site admin
Posts: 2696
Joined: 2009-06-28 06:09
Been thanked: 86 times

Re: Samba: how to lock file in use

#3 Post by 4D696B65 »

acewiza wrote:You might have better luck here: https://www.samba.org/
+1
I always go there for my samba issues. Very good docs and easy to navigate.

gi4mpy
Posts: 7
Joined: 2017-12-22 10:24

Re: Samba: how to lock file in use

#4 Post by gi4mpy »

4D696B65 wrote:
acewiza wrote:You might have better luck here: https://www.samba.org/
+1
I always go there for my samba issues. Very good docs and easy to navigate.
well I'm kinda dumb then cuz I didn't consider it :D

Ok thanks I'll check and let you know.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Samba: how to lock file in use

#5 Post by Segfault »

I've found the best place to put secrets is README file.

gi4mpy
Posts: 7
Joined: 2017-12-22 10:24

Re: Samba: how to lock file in use

#6 Post by gi4mpy »

No luck on Samba.org

anyway ideas? I was thinking even to set just a "read-only" when file is opened from another user, it's not really necessary to "lock" it

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1418
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 79 times
Been thanked: 191 times

Re: Samba: how to lock file in use

#7 Post by steve_v »

gi4mpy wrote:No luck on Samba.org
Elaborate. What did you try?
Presumably, as this machine is a "server", file access will be over SAMBA, and SAMBA only?
I'm pretty sure SAMBA supports this type of locking by default, You have looked here, right?
If you have non-samba writers as well, you will probably want to look into kernel oplocks.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

gi4mpy
Posts: 7
Joined: 2017-12-22 10:24

Re: Samba: how to lock file in use

#8 Post by gi4mpy »

steve_v wrote:
gi4mpy wrote:No luck on Samba.org
Elaborate. What did you try?
Presumably, as this machine is a "server", file access will be over SAMBA, and SAMBA only?
I'm pretty sure SAMBA supports this type of locking by default, You have looked here, right?
If you have non-samba writers as well, you will probably want to look into kernel oplocks.
I tried oplocks and locking...but I just mind that in the office all the employees are working with Mac OS. I suppose it changes everything because the documentation is about Windows

anyway right now this is the following config on smb.conf regarding the folder

---
[foldername]
path = /home/foldername
browseable = yes
guest ok = no
security = user
read only = no
create mask = 0775
directory mask = 0775
valid users = @groupname
---

anyway what I just want to prevent is to "overwrite" a file if someone is already working on it. As I said I worked on Debian more than 4 years ago and the major problem is that I don't remember a lot of things..

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1418
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 79 times
Been thanked: 191 times

Re: Samba: how to lock file in use

#9 Post by steve_v »

gi4mpy wrote:in the office all the employees are working with Mac OS.
Dunno whether this changes anything or not, oplocks do require client cooperation but I know zilch about the SMB implementation on MacOS.
All I can say is that locking works as described with both samba and windows 7 clients, for me at any rate.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

User avatar
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Re: Samba: how to lock file in use

#10 Post by acewiza »

Now that I see you are trying to integrate different filesystem comm protocols (Apple-CIFS, SAMBA, and ExtX), I wish you luck. Apple is notorious for tweaking their comm and FS protocols without any sort of cooperation and notification to the outside world. Things that worked well with Apple one day turn up broken the next, for no apparent reason.
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

gi4mpy
Posts: 7
Joined: 2017-12-22 10:24

Re: Samba: how to lock file in use

#11 Post by gi4mpy »

acewiza wrote:Now that I see you are trying to integrate different filesystem comm protocols (Apple-CIFS, SAMBA, and ExtX), I wish you luck. Apple is notorious for tweaking their comm and FS protocols without any sort of cooperation and notification to the outside world. Things that worked well with Apple one day turn up broken the next, for no apparent reason.
Basically I'm fuc**d :D

Sorry if I didn't provide properly all the details. So I suppose the "best" solution is to keep the actual configuration and live with it. There aren't more than 10 employees so maybe it will not be a big deal.

Thank you all guys, we can close this thread.

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1418
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 79 times
Been thanked: 191 times

Re: Samba: how to lock file in use

#12 Post by steve_v »

Well if samba doesn't do what you need, and you run an all Apple house, and you're feeling adventurous... there's always the Mac way.
I can't help you set it up though, my knowledge of AFP goes as far as "it exists, and somebody probably uses it".
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

gi4mpy
Posts: 7
Joined: 2017-12-22 10:24

Re: Samba: how to lock file in use

#13 Post by gi4mpy »

steve_v wrote:Well if samba doesn't do what you need, and you run an all Apple house, and you're feeling adventurous... there's always the Mac way.
I can't help you set it up though, my knowledge of AFP goes as far as "it exists, and somebody probably uses it".
Wow I didn't know about this :D looks interesting but I prefer to keep Debian.. I love Debian. Anyhow I want to install more services on this machine to one more reason to stay Debian and stay cool^

Thanks a lot for the tip :P

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1418
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 79 times
Been thanked: 191 times

Re: Samba: how to lock file in use

#14 Post by steve_v »

gi4mpy wrote:I didn't know about this :D looks interesting but I prefer to keep Debian..
Netatalk is in the Debian repos...
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

gi4mpy
Posts: 7
Joined: 2017-12-22 10:24

Re: Samba: how to lock file in use

#15 Post by gi4mpy »

steve_v wrote:
gi4mpy wrote:I didn't know about this :D looks interesting but I prefer to keep Debian..
Netatalk is in the Debian repos...
Ouch I dunno why I thought it was a distro linux-based for Mac OS

cfb
Posts: 52
Joined: 2017-01-08 16:39
Been thanked: 5 times

Re: Samba: how to lock file in use

#16 Post by cfb »

Have you considered using some kind of Version Control System instead of Samba? Subversion, Git, et al.

Post Reply