DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk8 min

Linux File Permissions and umask Explained for VPS Admins

A practical guide to Linux owner, group and other bits, directory search permission, umask defaults, setgid group inheritance, sticky directories and VPS troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Linux permissions are a two-stage system: mode bits decide what the owner, group, and everyone else may do, while umask removes bits when a new file or directory is created. A mode such as 755 therefore means different things on a directory than on a regular file, and a readable file can still be inaccessible when a parent directory does not grant search (execute) permission. For a VPS, combine least-privilege modes with a deliberate group strategy, setgid where teams share directories, and sticky bit protection where many users have write access.

How Linux permission bits are arranged

Every inode has permission bits for three classes: the owner, the owning group, and others (every account that is neither the owner nor a member of the owning group). Each class has read, write, and execute/search bits. The chmod command changes these existing bits; it does not control which bits are removed at creation time.

Class Numeric position Meaning
Owner First permission digit Access granted to the file’s owner
Group Second permission digit Access granted to users in the owning group
Others Third permission digit Access granted to all other users

Within each digit, read is worth 4, write is worth 2, and execute is worth 1. Add the values to express a combination: 6 is read plus write, 5 is read plus execute, and 7 is all three.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

As an Amazon Associate I earn from qualifying purchases.

What chmod 755 means

chmod 0755 directory grants the owner read, write, and search; grants the group read and search; and grants others read and search. On a directory, “execute” means search or traverse: the user may pass through the directory and access names inside it when the rest of the path also permits access.

The same numeric mode on a regular file has a different practical result. chmod 0755 script.sh gives the owner read/write/execute and gives group and others read/execute. Execute on a file permits it to be run (subject to the file format and interpreter), while read permits its contents to be read.

Common explicit modes

Command Result Typical use
chmod 0644 file Owner read/write; group and others read Ordinary non-secret configuration, text, or static files
chmod 0755 directory Owner read/write/search; group and others read/search Directories that must be traversable by non-owners
chmod 0600 secret Only the owner can read/write Private keys and other owner-only data
chmod 0700 private-dir Only the owner can read/write/search Private application or administrator directories

Use stat or ls -l to inspect the current owner, group, and mode before changing anything. Confirm the account that a service actually runs as; changing permissions for the wrong owner or group does not solve an access problem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why directory execute permission is really search permission

Access to a pathname is evaluated one directory component at a time. To open /srv/app/config/file, a process needs search permission on /srv, /srv/app, and /srv/app/config, plus the appropriate permission on file. A process may have read permission on the file and still receive “Permission denied” because it cannot search one of the parent directories.

  • Read on a directory: permits listing names in that directory, subject to other checks.
  • Write on a directory: permits creating, deleting, or renaming directory entries when the required search permission is also present.
  • Execute/search on a directory: permits traversing it and looking up entries by name.

This distinction explains many VPS service failures. If a daemon can read a file when given a direct file descriptor but cannot open the path from its configuration, inspect every parent directory. Grant the minimum search permission needed on the path rather than making the file world-writable.

How umask creates 644 files and 755 directories

umask is a creation-time filter. Linux turns off (removes) the permission bits present in the umask from the mode requested by open(2) or mkdir(2). It does not retroactively modify existing files.

Most programs request a base mode of 0666 for regular files and 0777 for directories, leaving the umask to remove unsafe bits. With umask 0022:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Object Requested base mode Bits removed by 0022 Typical resulting mode
Regular file 0666 Group write and others write 0644
Directory 0777 Group write and others write 0755

That is why a newly created file commonly appears as -rw-r--r-- and a new directory as drwxr-xr-x. The exact result depends on the program’s requested mode. An application can request fewer permissions, and a parent default ACL can alter the normal mode-plus-umask path.

Inspecting and setting a shell umask

  1. Run umask in the shell that will create the files. A value such as 0022 is normally printed in octal.
  2. For a private project workflow, set a more restrictive value, for example umask 0077. New regular files then normally lack group and other permissions, and new directories are normally owner-only.
  3. For a group-shared project, umask 0002 commonly preserves group write permission: a 0666 request becomes 0664, and a 0777 request becomes 0775.
  4. Create a test file and directory, then verify with ls -l before applying the setting to production workflows.

A setting made interactively affects that shell and processes it starts. Services launched by a supervisor may have a different environment, so check the service’s startup configuration and verify the mode of files it creates instead of assuming your login shell’s value applies.

Choosing a VPS umask

Use case Starting point What it protects What you must verify
Single administrator or private service data 0077 Prevents group and others from receiving requested permissions Any separate service account that legitimately needs access
Several administrators sharing a project group 0002 plus a controlled group Retains group write on commonly requested files and directories Group membership, setgid inheritance, and applications that create restrictive modes
General multi-user host 0022 Removes group/other write while allowing normal read/search access Whether files contain secrets that should be owner-only

There is no universally correct VPS value. Choose according to who must collaborate and whether data is confidential. Treat the umask as a default, not a substitute for reviewing application-specific modes, ownership, and ACLs.

Keeping shared project files in the same group

Set the setgid bit on the shared directory. For example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
chmod 2775 /srv/project

The leading 2 is the setgid special bit; the remaining 775 grants the owner and group read/write/search and others read/search. On a directory, setgid causes new entries to inherit the directory’s group instead of simply taking the creator’s primary group. This is the key to stable collaboration when several service or administrator accounts work in one tree.

  1. Create or select a dedicated Unix group for the project.
  2. Assign the directory to that group and add only the required accounts.
  3. Apply setgid with chmod 2775 /srv/project (or a more restrictive group/other mode when appropriate).
  4. Set a group-compatible umask, commonly 0002, for processes that should create group-writable content.
  5. Test creation by each relevant account and inspect both the group owner and mode.

Setgid controls group inheritance; it does not automatically grant write permission. The inherited group still needs permission in the resulting mode, and an application’s requested mode or an ACL may remove it.

Using the sticky bit in shared-write directories

For a directory where many users need to create files but should not delete one another’s entries, use the sticky bit:

chmod 1777 /srv/drop

The leading 1 is the sticky special bit. In a sticky directory, an entry can be renamed or deleted only by the entry’s owner, the directory’s owner, or a privileged process. Sticky does not make files private and does not prevent users from editing a file when its own mode grants write access; it limits rename and deletion operations on the directory entries.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the narrowest directory mode that meets the workflow. A world-writable directory is a broad trust boundary, even with sticky protection, so avoid placing credentials or executable deployment files there.

Special bits and numeric notation

Numeric modes may begin with a special-bit digit followed by owner, group, and other digits:

Special bit Octal constant Effect
setuid 04000 Special execution behavior on applicable files; treat as privileged code and audit before use.
setgid 02000 On directories, new entries inherit the directory group.
sticky 01000 On directories, restricts who may rename or delete entries.

GNU chmod also supports symbolic letters such as rwxXst. Symbolic changes can be safer for a narrow adjustment, for example adding group search without replacing every existing bit. Always inspect the result after a change, especially when special bits are involved.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Recursive changes: where VPS administrators get hurt

A blanket command such as chmod -R 755 /srv/app gives execute permission to every regular file and may expose secrets. It can also overwrite carefully chosen modes in vendor directories, sockets, or upload trees. Before a recursive change:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Define the trust boundary: which accounts need access, and which paths contain credentials?
  • Separate directories from files. Directories commonly need search; ordinary files often do not need execute.
  • Change a small sample first and verify with find, stat, or ls -l.
  • Record the previous ownership and mode so you can reverse an incorrect change.
  • Recheck service startup and deployment jobs after the change.

Apply privilege-bearing bits such as setuid and setgid only after confirming why they are required. A mode that is correct for a project directory can be dangerous when copied to an executable or a directory containing untrusted uploads.

When ACLs make the simple calculation wrong

The familiar calculation—requested mode minus umask—describes the normal path, but a parent default ACL can override that path. If a newly created entry has an unexpected group or extra access entries, inspect ACLs on the parent directory rather than repeatedly changing the umask.

In an ACL-managed tree, document the intended principals and test creation as the actual service account. A manually applied chmod may change the traditional owner/group/other bits without solving an ACL rule that continues to grant or restrict access.

VPS permission troubleshooting checklist

“The service can read the file but cannot open the path”

  1. Check the file’s owner, group, and read bit.
  2. Check search permission on every parent directory from the filesystem root to the file.
  3. Confirm the service account and its supplementary groups.
  4. Fix the narrowest missing directory permission; do not make the file world-writable as a shortcut.

“New files became 644, but I expected group write”

  1. Inspect the creating process’s umask.
  2. Confirm the application requested 0666 or another mode that includes group write.
  3. Check for a parent default ACL.
  4. For a shared tree, verify the directory has setgid and that the service account belongs to the intended group.

“Users can create files but delete each other’s files”

Inspect the directory mode. A shared-write directory without sticky protection allows deletion or rename according to directory permissions. Apply the sticky bit where that behavior is appropriate, then test as both the file owner and a different user.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“A permission change fixed one deployment and broke another”

Compare the accounts, groups, requested creation modes, and parent-directory search bits used by each deployment. Restore the known-good mode, then make a targeted change at the specific path instead of repeating a recursive command across the entire application tree.

A practical permission policy for a small VPS

  • Keep private keys, credentials, and service configuration owner-only unless a documented service group needs access.
  • Use 0022 for ordinary single-user administration when group/other read access is acceptable; use 0077 for private workflows.
  • For collaboration, create a dedicated group, set the project directory’s group and setgid bit, and align the creators’ umask with the desired group write policy.
  • Use sticky protection on intentionally shared-write drop directories.
  • Review ACLs whenever observed permissions do not match the mode-plus-umask calculation.
  • After every change, test the real service account against the complete path and verify both existing and newly created entries.

With these checks, chmod expresses the access policy for existing objects, umask supplies safe creation defaults, setgid keeps collaborative ownership predictable, and sticky protects deletion boundaries. The most reliable VPS configuration is the one whose modes, groups, creation defaults, and directory traversal rules have all been tested together.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.