# File Locking with SLES/Samba, need help!

**URL:** <https://forums.suse.com/t/file-locking-with-sles-samba-need-help/22433>\
**Category:** SLES Networking\
**Created:** [March 27, 2012, 6:37am UTC](https://forums.suse.com/t/file-locking-with-sles-samba-need-help/22433 "2012-03-27T06:37:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maRGas86](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@maRGas86](https://forums.suse.com/u/maRGas86)\
**Post date:** [March 27, 2012, 6:37am UTC](https://forums.suse.com/t/file-locking-with-sles-samba-need-help/22433/1 "2012-03-27T06:37:34Z")

</div>

Hello all,  
I’m novice at this so please excuse my ignorance.

I’ve just installed SLES11 on our new file server and also set up Samba on the server. There are 5 users that connect to the server via Windows Networking.

I need to be able to lock files when they are in use so that if another user tries to access the file it locks them out completely.

This is an example of one of the sections.

`[Restricted]
comment = Restricted
path = /Restricted
create mode = 0660
directory mode = 0770
valid users = @restricted
oplocks = yes
level2 oplocks = yes
blocking locks = yes
`

I’ve also tried to add the oplocks, level2 oplocks & blocking locks into the [Global] section but to no avail.

I’m obviously doing something wrong and am hoping you people who know a lot more than I do will be able to help me here.

Thank you.  
Daniel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/5/5012ba89e3ffb5220dac47d5ea0ba032e2fe1cb6.png) [@system](https://forums.suse.com/u/system)\
**Post date:** [April 5, 2012, 3:30pm UTC](https://forums.suse.com/t/file-locking-with-sles-samba-need-help/22433/2 "2012-04-05T15:30:39Z")

</div>

maRGas86,

It appears that in the past few days you have not received a response to your  
posting. That concerns us, and has triggered this automated reply.

Has your issue been resolved? If not, you might try one of the following options:

- Visit [http://www.suse.com/support](http://www.suse.com/support) and search the knowledgebase and/or check all  
the other support options available.
- You could also try posting your message again. Make sure it is posted in the  
correct newsgroup. ([http://forums.suse.com](http://forums.suse.com))

Be sure to read the forum FAQ about what to expect in the way of responses:  
[http://forums.suse.com/faq.php](http://forums.suse.com/faq.php)

If this is a reply to a duplicate posting, please ignore and accept our apologies  
and rest assured we will issue a stern reprimand to our posting bot.

Good luck!

Your SUSE Forums Team  
[http://forums.suse.com](http://forums.suse.com)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/5/5012ba89e3ffb5220dac47d5ea0ba032e2fe1cb6.png) [@system](https://forums.suse.com/u/system)\
**Post date:** [April 25, 2012, 8:27pm UTC](https://forums.suse.com/t/file-locking-with-sles-samba-need-help/22433/3 "2012-04-25T20:27:39Z")

</div>

How do you check, that there a no file locks set?

Normally if you run smbstatus you should see all open files and their  
locks.

–  
W. Prindl

maRGas86 wrote:  
[color=blue]

> Hello all,  
> I’m novice at this so please excuse my ignorance.
> 
> I’ve just installed SLES11 on our new file server and also set up  
> Samba on the server. There are 5 users that connect to the server via  
> Windows Networking.
> 
> I need to be able to lock files when they are in use so that if  
> another user tries to access the file it locks them out completely.
> 
> This is an example of one of the sections.
> 
> ## Code:
> 
> [Restricted]  
> comment = Restricted  
> path = /Restricted  
> create mode = 0660  
> directory mode = 0770  
> valid users = @restricted  
> oplocks = yes  
> level2 oplocks = yes  
> blocking locks = yes
> 
> * * *
> 
> I’ve also tried to add the oplocks, level2 oplocks & blocking locks  
> into the [Global] section but to no avail.
> 
> I’m obviously doing something wrong and am hoping you people who know  
> a lot more than I do will be able to help me here.
> 
> Thank you.  
> Daniel[/color]
