Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Remove the Lock Symbol from Files and Directories in Linux

Fix the permissions or the owner that make the file manager show a lock icon.

Fixing Errors2 min read2 screenshots

Why the lock symbol appears

The lock icon in the file manager means your user cannot read, write or open the file or folder. This comes from the permissions, or from the owner being another user such as root.

A directory with a lock symbol

Check the permissions first

ls -ld my-directory

The output looks like drwx------ 2 root root .... The first letters are the permissions, then the owner and the group.

Fix 1: Change the owner (best)

If the folder belongs to root and you need to use it, give it to your user:

sudo chown -R $USER:$USER my-directory

Fix 2: Add the missing permissions

Give the owner full rights, and the group and others read and execute rights:

chmod 755 my-directory

For a file that you need to edit:

chmod 644 my-file

Apply a rule to a folder and all that is inside it:

sudo chmod -R u+rwX my-directory

X adds execute only to folders and to files that are already executable.

Fix 3: Use an ACL for one user

Give one user access without changing the owner:

sudo setfacl -m u:$USER:rwx my-directory

Check it with getfacl my-directory.

About chmod 777

Many tutorials use chmod 777 to make the lock disappear. That gives every user on the system full access, which is a security risk, so avoid it. Use a more specific permission as shown above. Only use 777 on a folder in an isolated test system.

After the fix, reload the folder in the file manager. The lock symbol disappears.

The folder without the lock symbol

Numeric permissions

Each digit is the sum of read (4), write (2) and execute (1). The three digits are for the owner, the group and others.

NumberMeaning
7read, write, execute
6read, write
5read, execute
4read only
0no access

Examples: 755 is common for folders, 644 for files, and 600 for private files.

Quick recap

  • Check with ls -ld.
  • Fix the owner with chown and the mode with chmod.