I'm trying to lock a file and obviously there is something I'm missing, because eventhough it seems it's locked I can still access and edit it using vim editor.
Locking file:
flock -x lock2.txt sleep 30
Checking using lslocks:
COMMAND PID TYPE SIZE MODE M START END PATH
flock 5417 FLOCK 10B WRITE 0 0 0 /home/lock2.txt
But still able to access it and edit using different terminal (different process I believe). I tried the solution with file descriptors here Linux flock, how to "just" lock a file? but the result is still the same.