Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Permission MirrorNew to Visual Studio Code? Get it now.
Permission Mirror

Permission Mirror

kryogeniks

|
2 installs
| (1) | Free
Enforces directory group ownership and permissions on file or directory creation.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Permission Mirror

by: Kryogeniks

Introduction

Permission Mirror is a VS Code extension that applies inheritance when new files or directories are created, ensuring they match the parent’s ownership and permission model. Existing files are not altered on save, so any intentional changes to permissions or group ownership remain intact.

Why?

By default, Linux only applies group ownership if the user’s active group matches. Permission Mirror bridges that gap by interpreting directory intent (g+s) and enforcing it automatically, so you don’t have to run chgrp manually.

Features
  • Mirrors parent directory permissions on file or directory creation.
  • Applies execute bits to files only if they are configured as auto‑executable (e.g. .sh).
  • Always mirrors execute bits for directories to allow traversal.
  • Enforces group ownership when parent has setgid.
  • Preserves g+s on new directories when parent has setgid.

Setup and Installation

  1. Clone this repo:
    git clone https://github.com/kryogeniks/PermissionMirror.git
    cd PermissionMirror
    
  2. Install dependencies:
    npm install
    
  3. Compile TypeScript:
    npm run compile
    
  4. Open the folder in VS Code and press F5 to launch an Extension Development Host, or run vsce package to build a .vsix and install it.

Usage

  • On file or directory creation, permissions are mirrored automatically.
  • Create a file inside a directory with the setgid bit set (chmod g+s dir).
  • If you’re a member of that directory’s group, the extension will automatically chgrp the file.
  • If not, the file is created normally without errors.

Example

Here’s how permissions are mirrored in practice:

Example: parent is root:www-data

Context Permissions Owner:Group
Parent drwxr-s--- root:www-data
New file -rw-r----- user1:group2
New .sh file -rwxr-x--- user1:group2
New directory drwxr-s--- user1:group2

    1 current user
    2 directory's set-group, if applicable; otherwise active group


Example: parent is alice:dev

Context Permissions Owner:Group
Parent drwxrwxr-x alice:dev
New file -rw-rw-r-- user1:group2
New .py file -rwxrwxr-x user1:group2
New directory drwxrwxr-x user1:group2

    1 current user
    2 current active group

Requirements

  • Unix-like OS (Linux, macOS).
  • User must be a member of the target group for enforcement to succeed.
  • Standard tools available: stat, chgrp.

Notes

  • No effect on Windows — the extension silently skips.
  • Lightweight utility for exploring group ownership automation in your workflow.

Changes

CHANGELOG

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft