Skip to content

Instantly share code, notes, and snippets.

@avidrucker
Created June 21, 2024 16:37
Show Gist options
  • Save avidrucker/a647faf6e4ad46bfee95977ffe3b20b6 to your computer and use it in GitHub Desktop.
Save avidrucker/a647faf6e4ad46bfee95977ffe3b20b6 to your computer and use it in GitHub Desktop.
mermaid diagram showing relationships, permissions between Linux users, groups, files, including representation of set-UID and set-GID privileges
graph TD
    subgraph "USERS and GROUPS"
        User2(User 2)
        User1(User 1)
        User3(User 3)
        Root(Root User)
        Group1(Group 1)
        Group2(Group 2)
        Staff(Staff Group)
    end

    subgraph "FILES"
        File1[File 1: -rw-r--r--]
        File2[File 2: -rwxr-sr-x, Set-GID]
        File3[File 3: -rwsr-xr-x, Set-UID]
    end

    %% User to File Ownership
    User2 -->|Owns| File2
    Root -->|Owns| File3

    %% Group Memberships
    Group1 -.->|Member| User2
    Group1 -.->|Member| User1
    Group2 -.->|Member| User3
    Staff -.->|Member| Root

    %% Group to File Ownership
    Group1 -.->|Group Owner| File1
    Group2 -.->|Group Owner| File2
    Staff -.->|Group Owner| File3

    %% User Access to Files
    User1 -.->|Access via others' permissions| File2
    User2 -.->|Access via others' permissions| File1
    User3 -.->|Access via others' permissions| File3
    User3 -.->|Access via group permissions| File2
    User3 -.->|Access via others' permissions| File1

    %% User to File Ownership Continued
    User1 -->|Owns| File1

    %% File Permissions
    File1 -.->|Others read| Perm3[Read]
    File1 -.->|Group read| Perm2[Read]
    File1 -.->|Owner read/write| Perm1[Read/Write]

    File2 -.->|Others read/execute| Perm6[Read/Execute]
    File2 -.->|Group read/execute with Set-GID| Perm5[Read/Execute as Group]
    File2 -.->|Owner read/write/execute| Perm4[Read/Write/Execute]

    File3 -.->|Others read/execute| Perm9[Read/Execute]
    File3 -.->|Group read/execute| Perm8[Read/Execute]
    File3 -.->|Owner read/write/execute with Set-UID| Perm7[Read/Write/Execute as Owner]
    
    style File2 stroke-dasharray: 5,5
    style File3 stroke-dasharray: 5,5
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment