Whenever I open my documents, all the folders in it are displayed with a lock icon. Therefore, I cannot delete any file or folder in it.

I tried changing the root access using sudo chmod user:directory/ but it fails. I am not able to delete or perform any file action with it.

What action should I perform to fix it?

  • 2
    Please take a screenshot from Permissions and post it (or upload it and put the link to it) here. To see permissions, right click on a folder or file and select Properties. – AliN Mar 3 '13 at 14:09
  • Hey I have same problem with ubuntu 13.10. But all folders turn locked suddenly. and I can't open any program even shutdown doesn't work. To execute commands >> no chance at all because no program open up including terminal too. ultimately i had to restart the machine. please suggest any method to get rid of this bug.. – user269619 Apr 16 '14 at 17:26

Run the following to fix your home directory permissions:

sudo chown -R $USER: $HOME
  • This will change the permissions or directly delete the folder?? – MashukKhan Dec 15 '16 at 6:24
  • @MashukKhan This will restore the correct ownership of your home folder and subfolders. Nothing will be deleted. – Eric Carvalho Dec 15 '16 at 11:02
  • 1
    After running the command I had to reboot my system for changes to take effect. It worked great! – codeaviator Sep 7 '17 at 12:15
  • Worked like charm, I ran the command from the path, where the locked folder existed. – Shamsul Arefin Sajib Jun 27 '19 at 8:06
  • works, but what happened? – nanquim Sep 14 '19 at 22:12

sudo chmod 777 -R /path to folder you want to delete- This would give all permissions (Read, Write, Execute) to you

The permissions (in this case 777) are as follow:

  • 7 - Full (Read, Write & Execute)
  • 6 - read and write
  • 5 - read and execute
  • 4 - read only
  • 3 - write and execute
  • 2 - write only
  • 1 - execute only
  • 0 - none

First number change Ownership of file, second affect Group of users can access, and third refers to Others user.

Owner   Group   Other
  7       7       7

after changing the permission, try and delete the folder.

  • 2
    This would also allow anyone else to access the folder, including guests. – Marco Scannadinari Mar 7 '13 at 18:32
  • thats why i have given you the explanation. use 757 instead of 777 then – Janmejay Mar 8 '13 at 20:26
  • sudo chmod u+w -R path_to_folder is a neater way of giving yourself write permission. Not that it makes much difference if you're deleting the folder anyway. – lane Sep 7 '16 at 12:58
  • Very simple and clean explanation – VVB Sep 22 '17 at 15:08
  • To apply all permission on current directory type and run: sudo chmod 777 -R . – EsmaeelE Nov 20 '18 at 11:48

Open terminal and type

gksudo nautilus

Browse to the location of documents. Goto properties and set the permission for owner as well as group as read and write. Now try to delete the folder from another nautilus window (one without root privileges).

Don't forget to close that super user nautilus as soon as you don't need it any more!

  • 3
    Never suggest sudo nautilus - gksudo nautilus is the recommended command - if really needed at all. – guntbert Mar 3 '13 at 18:49

This would happen probably because you downloaded something from the web. And you don't have the write access to the folders. If you are sure that the files are virus free, try the following command.

chmod -R +rw *

This will remove the lock icon from the nautilus.


I had this problem as I had set everything to chmod 755 to get back into my system after messing with /var permissions.

sudo chown -R $USER:$USER ~

solved it for me, eventually. I had to delete some files I'd downloaded first.


Change the file permissions of lock file via CHMOD command:

user@pc:~$ sudo chmod 754 /var/lib/lock *

Note: 754 is access permission and path to the directory of lock file present if 754 doesn't, do try 777. Once done you can delete the file.


You should have a look at this answer on Super User. Adding on to this answer, you can also create a bash function like this:

# bash function for changing locked status of folders, pass folder name as command line argument
unlock() {
    chflags -R nouchg $1

You can put this function in your .bashrc (Linux) or .bash_profile (Mac) file and run source ~/.bashrc or source ~/.bash_profile to rebuild the bash file.

Not the answer you're looking for? Browse other questions tagged or ask your own question.