Posted in

Nextcloud: How to unlock a file

When a file is locked you can’t do anything with it, including deleting it. All instructions tell you to wipe the locks table in your database or tweak your settings, but that doesn’t work.

Method 1: Context menu

On a file go to the dots ••• menu

There scroll the menu down to Unlock file and tap it. If it works, you’re done.

Sometimes you have to reload the page to see it unlocked.

When you get the “Unlock file: failed” error, try method 2 below.

Method 2: Using the CLI console

First you need the file ID. You can find it in the address bar when you open a file. The number before the ? character.

Examples where 12345 is the file ID:

 
https://nextcloud/apps/eurooffice/12345?filePath=%2FNew%20document.docx
https://nextcloud/apps/files/files/12345?dir=/&opendetails=true

Another way is to copy the internal link.

On a file go to ••• > Sharing options > Internal link > Copy button

That will give you a URL similar to this:

 
https://your.nextcloud/f/12345

Take the number at the end: 12345

On the terminal run this command:

 
php occ files:lock -u 12345 username

That’s all

Leave a Reply

Your email address will not be published. Required fields are marked *