Samba: who keeps a file opened?

You can use the smbstatus command to get a list of current Samba connections (processes, shares and locks). However if you're looking for the user who has a specific file open, then first you've to look for a lock in the lock list (smbstatus --locks), then you've to look up the username for the given PID in the process list (smbstatus --processes). I've made a script that uses awk to process the output of smbstatus and print the name of the user who keeps opened the file specified in the parameters.

AttachmentSize
samba_opened_by-v1.0.sh905 bytes
Syndicate content