Amazon Cyber Monday deals See deals →ad

Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

Linux Home Directory Permissions: Modes and Safe Defaults

Linux home directory permissions control who can list, read, or change files in a user’s personal directory. For a private home directory, a common choice is mode 700 for the directory itself, while 755 allows other users to enter and list it; the right setting depends on whether sharing is intended.

What home directory permissions mean

A home directory is usually the directory named for a user under /home, such as /home/alex. The user’s account record identifies its home path and login shell; the directory’s owner and permission bits determine ordinary access to its contents. The system administrator, often the root user, can still access or change files regardless of ordinary user permissions.

Linux permissions are defined separately for the file’s owner, its group, and everyone else. The three basic rights are:

  • Read (r): For a directory, allows listing its names. On a regular file, allows reading its contents.
  • Write (w): For a directory, allows creating, deleting, or renaming entries, subject to other rules. On a regular file, allows changing its contents.
  • Execute (x): For a directory, allows searching or traversing it when the path is known. On a regular file, it can allow running the file as a program.

Directory execute permission is easy to misunderstand: a user generally needs it on every directory in a path to reach a file. Read permission on a directory does not by itself grant permission to read the files listed there; each file has its own permissions.

Common permission modes and what they allow

Modes are often written as three octal digits, one for the owner, group, and others. Each digit adds read as 4, write as 2, and execute as 1. Thus 7 means read, write, and execute; 5 means read and execute; and 0 means no access.

  • 700 (rwx------): The owner can access the directory; group members and other users have no permissions. This is a common private setting.
  • 750 (rwxr-x---): The owner has full access, members of the directory’s group can traverse and list it, and others have no access.
  • 755 (rwxr-xr-x): The owner has full access; other users can traverse and list the directory, but cannot create or remove entries there.
  • 770 or 775: These grant group access, with the precise rights shown by the final two digits. They can suit a deliberately shared group directory.

These modes describe the directory, not everything beneath it. A private home directory can contain a file with broader permissions, and a permissive home directory can contain a private file. Check both levels when diagnosing access or privacy.

Choosing a setting for your needs

For a personal account on a multi-user machine, 700 is a straightforward privacy choice. It prevents other unprivileged accounts from listing the home directory or traversing it. On a single-user desktop, administrators may instead use 755 for practical reasons, such as letting system services or other accounts access files deliberately made public. Do not assume that every application needs access to every user’s home.

Use group access only when it is intentional. For example, a team may use a shared group and a directory set to 2770; the leading 2 sets the setgid bit, which usually causes new items created there to inherit the directory’s group. That is a shared-directory design, not a necessary default for an individual’s entire home. Access control lists (ACLs) can provide more specific exceptions, but they add complexity and should be checked when ordinary mode bits do not explain the result.

Also consider the application. Some programs reject configuration files or SSH private keys that are accessible to other users. A locked-down home does not replace correct permissions on sensitive files, and a shared home can expose more than intended: filenames, shell history, application settings, tokens, or private documents.

Inspecting and changing permissions

Run ls -ld on the home path to inspect the directory itself:

ls -ld /home/alex

A result such as drwx------ 20 alex alex ... /home/alex indicates mode 700 and shows the owner and group. The initial d means it is a directory. Check the account’s actual home path with getent passwd alex if it may not be under /home.

To set the directory to mode 700, use an administrator account or the directory’s owner:

chmod 700 /home/alex

To change ownership when it is genuinely wrong, an administrator can run chown alex:alex /home/alex, adjusting the group to the account’s intended group. Avoid changing ownership or permissions recursively without first understanding the files involved. For instance, chmod -R 700 would also remove group and other access from every regular file and make every file executable, which is usually not what you want.

If you need to repair a complete home tree, first inspect it and decide separate permissions for directories and files. A broad recursive command can break shared files, executable scripts, application expectations, or ACLs. Back up important data and consult the distribution or service documentation before applying bulk changes.

Common problems and security misconceptions

  • “755 means other users can edit my files.” Not by itself. The directory’s group and other write bits are off, so other users cannot normally create or delete entries there. They may still read files that grant them read access.
  • “700 makes the account completely inaccessible.” It blocks ordinary access by other users, but not the administrator, privileged services, or processes running as the account owner. It also does not protect data on an unencrypted disk from someone who can access the disk offline.
  • “Changing the home mode fixes every private file.” It does not change the permissions of existing files inside. A file can have its own mode, ACL, or other access controls.
  • “If access fails, the home directory must be the cause.” A missing execute bit on a parent directory, an incorrect owner, an ACL, a mounted filesystem option, or a security policy such as SELinux can also block access.

Use the least access needed, especially on shared systems. If a service must read a particular file, grant access to that file or a dedicated group where practical rather than making the entire home directory broadly accessible.

Frequently Asked Questions

What permissions should a Linux home directory have?
A private personal home commonly uses 700. A system may use 755 or a group-access mode for a specific sharing or service requirement. Check local policy before changing a managed account.

How do I make my home directory private?
First confirm the correct path, then run chmod 700 "$HOME" as the owner. This changes the directory’s mode only, not the permissions of files within it.

Can other users see files in a directory set to 755?
They can generally traverse and list that directory. Whether they can read a particular file depends on that file’s permissions and any ACLs or security policies.

Why can’t I access a file even though it is readable?
You need search (execute) permission on the file’s parent directories along the path, as well as the necessary file permission. Ownership, ACLs, mount settings, or security controls may also deny access.

Should I use chmod -R 700 on my home directory?
Usually not. It changes every descendant, including regular files, and gives all of them execute permission for the owner. Set the top-level directory separately and inspect files before making recursive changes.

Linux Home Directory Permissions: Modes and Safe Defaults
Scroll to top