{"id":3680,"date":"2025-12-29T18:57:43","date_gmt":"2025-12-29T15:57:43","guid":{"rendered":"https:\/\/www.dchost.com\/blog\/designing-linux-users-groups-and-sudo-on-a-vps-for-multiple-projects-and-teams\/"},"modified":"2026-11-04T22:19:23","modified_gmt":"2026-11-04T19:19:23","slug":"linux-vps-users-groups-sudo","status":"publish","type":"post","link":"https:\/\/www.dchost.com\/blog\/en\/linux-vps-users-groups-sudo\/","title":{"rendered":"Linux VPS Users, Groups and sudo Permissions"},"content":{"rendered":"<div class=\"dchost-blog-content-wrapper\"><p>When you put several projects and multiple teams on a single Linux <a href=\"https:\/\/www.dchost.com\/vps\">VPS<\/a>, access management matters alongside CPU and RAM capacity. Who can log in where? Who can deploy? Who can touch production databases? If you do not design a clear user, group and sudo structure from day one, the server slowly turns into a black box of shared passwords, random symlinks and mysterious file owners.<\/p>\n<p>This guide connects Linux users, groups and <strong>sudo permissions<\/strong> in one worked multi-project model. It retains separate production\/staging roles, deployment and runtime identities, file\/ACL controls, service scope, database privileges, SSH and offboarding. The concrete shop exercise below is reusable for other projects; a role name alone is not an access boundary.<\/p>\n<div id=\"toc_container\" role=\"navigation\" aria-label=\"Table of Contents\" data-nosnippet class=\"toc_transparent no_bullets toc_numbered toc_title_center\"><p class=\"toc_title\">\u0130\u00e7indekiler<\/p><ul class=\"toc_list\"><li><a href=\"#Why_User_Group_and_sudo_Design_Matters_on_a_MultiProject_VPS\"><span class=\"toc_number toc_depth_1\">1.<\/span> Why User, Group and sudo Design Matters on a Multi\u2011Project VPS<\/a><\/li><li><a href=\"#Core_Building_Blocks_Users_Groups_Permissions_and_sudo\"><span class=\"toc_number toc_depth_1\">2.<\/span> Core Building Blocks: Users, Groups, Permissions and sudo<\/a><ul><li><a href=\"#Users_Human_vs_service_accounts\"><span class=\"toc_number toc_depth_2\">2.1.<\/span> Users: Human vs service accounts<\/a><\/li><li><a href=\"#Groups_Shared_permissions\"><span class=\"toc_number toc_depth_2\">2.2.<\/span> Groups: Shared permissions<\/a><\/li><li><a href=\"#Permissions_and_umask\"><span class=\"toc_number toc_depth_2\">2.3.<\/span> Permissions and umask<\/a><\/li><li><a href=\"#sudo_Controlled_privilege_escalation\"><span class=\"toc_number toc_depth_2\">2.4.<\/span> sudo: Controlled privilege escalation<\/a><\/li><\/ul><\/li><li><a href=\"#Designing_an_Architecture_for_Multiple_Projects_and_Teams\"><span class=\"toc_number toc_depth_1\">3.<\/span> Designing an Architecture for Multiple Projects and Teams<\/a><ul><li><a href=\"#Step_1_Map_your_reality\"><span class=\"toc_number toc_depth_2\">3.1.<\/span> Step 1: Map your reality<\/a><\/li><li><a href=\"#Step_2_Define_user_types\"><span class=\"toc_number toc_depth_2\">3.2.<\/span> Step 2: Define user types<\/a><\/li><li><a href=\"#Step_3_Define_group_types\"><span class=\"toc_number toc_depth_2\">3.3.<\/span> Step 3: Define group types<\/a><\/li><li><a href=\"#Step_4_Plan_directory_layout\"><span class=\"toc_number toc_depth_2\">3.4.<\/span> Step 4: Plan directory layout<\/a><\/li><li><a href=\"#Step_5_Decide_your_sudo_policy\"><span class=\"toc_number toc_depth_2\">3.5.<\/span> Step 5: Decide your sudo policy<\/a><\/li><\/ul><\/li><li><a href=\"#Concrete_Example_One_VPS_Three_Projects_Two_Teams\"><span class=\"toc_number toc_depth_1\">4.<\/span> Concrete Example: One VPS, Three Projects, Two Teams<\/a><ul><li><a href=\"#Users\"><span class=\"toc_number toc_depth_2\">4.1.<\/span> Users<\/a><\/li><li><a href=\"#Groups\"><span class=\"toc_number toc_depth_2\">4.2.<\/span> Groups<\/a><\/li><li><a href=\"#Directory_ownership\"><span class=\"toc_number toc_depth_2\">4.3.<\/span> Directory ownership<\/a><\/li><li><a href=\"#Group_membership\"><span class=\"toc_number toc_depth_2\">4.4.<\/span> Group membership<\/a><\/li><li><a href=\"#sudo_rules\"><span class=\"toc_number toc_depth_2\">4.5.<\/span> sudo rules<\/a><\/li><\/ul><\/li><li><a href=\"#Implementing_the_Design_StepbyStep_on_Linux\"><span class=\"toc_number toc_depth_1\">5.<\/span> Implementing the Design Step\u2011by\u2011Step on Linux<\/a><ul><li><a href=\"#1_Create_Project_Groups_and_Required_Accounts\"><span class=\"toc_number toc_depth_2\">5.1.<\/span> 1. Create Project Groups and Required Accounts<\/a><\/li><li><a href=\"#2_Verify_Personal_Accounts_and_Membership\"><span class=\"toc_number toc_depth_2\">5.2.<\/span> 2. Verify Personal Accounts and Membership<\/a><\/li><li><a href=\"#3_Separate_Local_Runtime_Tasks_from_CI_Login\"><span class=\"toc_number toc_depth_2\">5.3.<\/span> 3. Separate Local Runtime Tasks from CI Login<\/a><\/li><li><a href=\"#4_Set_Code_Data_and_Log_Permissions\"><span class=\"toc_number toc_depth_2\">5.4.<\/span> 4. Set Code, Data and Log Permissions<\/a><\/li><li><a href=\"#5_Verify_File-Creation_Policy\"><span class=\"toc_number toc_depth_2\">5.5.<\/span> 5. Verify File-Creation Policy<\/a><\/li><li><a href=\"#6_Install_Exact_sudo_Rules\"><span class=\"toc_number toc_depth_2\">5.6.<\/span> 6. Install Exact sudo Rules<\/a><ul><li><a href=\"#Project-scoped_operations\"><span class=\"toc_number toc_depth_3\">5.6.1.<\/span> Project-scoped operations<\/a><\/li><li><a href=\"#Database_Tasks_and_Privilege_Boundaries\"><span class=\"toc_number toc_depth_3\">5.6.2.<\/span> Database Tasks and Privilege Boundaries<\/a><\/li><li><a href=\"#Ops_full_admin_sudo_rules\"><span class=\"toc_number toc_depth_3\">5.6.3.<\/span> Ops \/ full admin sudo rules<\/a><\/li><\/ul><\/li><li><a href=\"#7_Tie_it_into_your_security_hardening\"><span class=\"toc_number toc_depth_2\">5.7.<\/span> 7. Tie it into your security hardening<\/a><\/li><\/ul><\/li><li><a href=\"#Security_Best_Practices_and_Common_Pitfalls\"><span class=\"toc_number toc_depth_1\">6.<\/span> Security Best Practices and Common Pitfalls<\/a><ul><li><a href=\"#Avoid_shared_accounts\"><span class=\"toc_number toc_depth_2\">6.1.<\/span> Avoid shared accounts<\/a><\/li><li><a href=\"#Never_fix_permissions_with_777\"><span class=\"toc_number toc_depth_2\">6.2.<\/span> Never \u201cfix\u201d permissions with 777<\/a><\/li><li><a href=\"#Disable_direct_root_SSH_login\"><span class=\"toc_number toc_depth_2\">6.3.<\/span> Disable direct root SSH login<\/a><\/li><li><a href=\"#Separate_staging_from_production\"><span class=\"toc_number toc_depth_2\">6.4.<\/span> Separate staging from production<\/a><\/li><li><a href=\"#Combine_with_a_firewall_and_log_monitoring\"><span class=\"toc_number toc_depth_2\">6.5.<\/span> Combine with a firewall and log monitoring<\/a><\/li><\/ul><\/li><li><a href=\"#Scaling_the_Model_From_One_VPS_to_Many\"><span class=\"toc_number toc_depth_1\">7.<\/span> Scaling the Model: From One VPS to Many<\/a><ul><li><a href=\"#Standardise_your_pattern\"><span class=\"toc_number toc_depth_2\">7.1.<\/span> Standardise your pattern<\/a><\/li><li><a href=\"#Automate_with_Ansible_and_Terraform\"><span class=\"toc_number toc_depth_2\">7.2.<\/span> Automate with Ansible and Terraform<\/a><\/li><li><a href=\"#Consider_central_authentication_for_larger_teams\"><span class=\"toc_number toc_depth_2\">7.3.<\/span> Consider central authentication for larger teams<\/a><\/li><\/ul><\/li><li><a href=\"#A_Maintainable_VPS_Access_Model\"><span class=\"toc_number toc_depth_1\">8.<\/span> A Maintainable VPS Access Model<\/a><\/li><\/ul><\/div>\n<h2><span id=\"Why_User_Group_and_sudo_Design_Matters_on_a_MultiProject_VPS\">Why User, Group and sudo Design Matters on a Multi\u2011Project VPS<\/span><\/h2>\n<p>On a single\u2011tenant server, it is tempting to use one account such as <code>ubuntu<\/code> or <code>root<\/code>, share its SSH key in the team and move on. On a multi\u2011project VPS used by several developers, agencies or clients, that approach quickly becomes a liability.<\/p>\n<ul>\n<li><strong>Weak accountability:<\/strong> With shared accounts, account-level logs alone cannot reliably answer questions like \u201cWho edited <code>config.php<\/code> yesterday?\u201d or \u201cWho ran that dangerous command?\u201d<\/li>\n<li><strong>Hard permission boundaries:<\/strong> When all code runs under one user, it is hard to keep Project A from reading or overwriting Project B\u2019s files.<\/li>\n<li><strong>Risky operations:<\/strong> If everyone has full <code>sudo<\/code>, a typo in production can drop a database or bring the web stack down.<\/li>\n<li><strong>Painful off\u2011boarding:<\/strong> When someone leaves, shared keys and passwords they knew must be rotated; individually assigned keys can instead be revoked.<\/li>\n<\/ul>\n<p>A clear architecture for Linux users, groups and sudo helps address these problems. It supports:<\/p>\n<ul>\n<li><strong>Per\u2011person access:<\/strong> One Unix account per human, their own SSH key, clearer individual revocation.<\/li>\n<li><strong>Per\u2011project access boundaries:<\/strong> Dedicated project groups and restrictive directory permissions limit file access. Separate runtime users are also needed to keep applications from sharing the same file-access identity.<\/li>\n<li><strong>Role\u2011based sudo:<\/strong> Carefully scoped rules can allow developers to restart PHP\u2011FPM or Nginx without granting full administration. The boundary also depends on preventing them from modifying code or configuration that those commands execute as root.<\/li>\n<li><strong>Cleaner deployments:<\/strong> CI pipelines and automation tools use well\u2011defined service users with minimal permissions.<\/li>\n<\/ul>\n<p>A developer who can change deployed code can also influence what that runtime account does with its application data. Separating runtime from root limits this scope; it does not make an untrusted code author unable to reach the application\u2019s own secrets.<\/p>\n<p>If you are setting up a brand\u2011new VPS at dchost.com, this should sit right next to your first\u2011day tasks like updates and firewall rules. Our guide on <a href=\"https:\/\/www.dchost.com\/blog\/en\/first-24-hours-on-a-new-vps-updates-firewall-and-users-step-by-step\/\">the first 24 hours on a new VPS (updates, firewall and users)<\/a> pairs nicely with the concepts we will cover here.<\/p>\n<h2><span id=\"Core_Building_Blocks_Users_Groups_Permissions_and_sudo\">Core Building Blocks: Users, Groups, Permissions and sudo<\/span><\/h2>\n<p>Before designing the architecture, it is worth revisiting the basic Linux concepts we are going to combine.<\/p>\n<h3><span id=\"Users_Human_vs_service_accounts\">Users: Human vs service accounts<\/span><\/h3>\n<p>A <strong>user<\/strong> in Linux is an identity: it owns files and can run processes. Separate these three purposes on a multi-project VPS:<\/p>\n<ul>\n<li><strong>Humans:<\/strong> personal accounts such as alice, bob and carol, enrolled with the intended SSH and sudo authentication policy.<\/li>\n<li><strong>Deployment accounts:<\/strong> own releases and run only approved tasks; avoid running builds or migrations as root.<\/li>\n<li><strong>Runtime accounts:<\/strong> separate process identities per project\/environment. A nologin shell denies normal shell execution; systemd can still start a program under that identity.<\/li>\n<\/ul>\n<h3><span id=\"Groups_Shared_permissions\">Groups: Shared permissions<\/span><\/h3>\n<p>A <strong>group<\/strong> is a way to give several users the same access to some resources. On a multi\u2011project VPS, groups are your main tool for representing:<\/p>\n<ul>\n<li><strong>Projects:<\/strong> <code>proj_blog<\/code>, <code>proj_api<\/code><\/li>\n<li><strong>Teams:<\/strong> <code>team_frontend<\/code>, <code>team_ops<\/code><\/li>\n<li><strong>Roles:<\/strong> <code>sudo_web<\/code> for web stack operations, <code>sudo_db<\/code> for DB operations<\/li>\n<\/ul>\n<p>Permissions are then applied to these groups at the directory and sudo level.<\/p>\n<h3><span id=\"Permissions_and_umask\">Permissions and umask<\/span><\/h3>\n<p>Linux file permissions define what the <strong>owner<\/strong>, <strong>group<\/strong> and <strong>others<\/strong> can do: read (<code>r<\/code>), write (<code>w<\/code>), execute (<code>x<\/code>). For example, <code>750<\/code> means:<\/p>\n<ul>\n<li>Owner: <code>rwx<\/code> (7)<\/li>\n<li>Group: <code>r-x<\/code> (5)<\/li>\n<li>Others: <code>---<\/code> (0)<\/li>\n<\/ul>\n<p>We will rely on group permissions heavily, so it is worth revisiting our article <a href=\"https:\/\/www.dchost.com\/blog\/en\/linux-file-permissions-644-755-777-explained-for-shared-hosting-and-vps\/\">explaining Linux file permissions (644, 755, 777) for shared hosting and VPS<\/a> if you need a refresher.<\/p>\n<p>The <strong>umask<\/strong> controls default permissions of new files. For collaborative project directories, we usually want new files to be writable by the group, not just the owner.<\/p>\n<h3><span id=\"sudo_Controlled_privilege_escalation\">sudo: Controlled privilege escalation<\/span><\/h3>\n<p><code>sudo<\/code> lets a user run commands as another user (often <code>root<\/code>) and normally logs command invocations. That does not by itself provide a complete audit of actions inside an invoked shell or application. The configuration lives in <code>\/etc\/sudoers<\/code> and included files; verify that <code>\/etc\/sudoers.d\/<\/code> is actually included. With sudo you can say things like:<\/p>\n<ul>\n<li>A project operations group can receive exact commands for a dedicated project unit. Shared nginx\/PHP-FPM restarts remain shared maintenance.<\/li>\n<li>Database tasks use a restricted OS identity plus appropriate database privileges, not unrestricted root clients.<\/li>\n<li>Other users receive no sudo from these rules; inspect every additional rule and alternative authorization path.<\/li>\n<\/ul>\n<p>Scoped sudo rules make the permitted target identity and operation explicit. Review their dependencies and test both permitted and rejected commands.<\/p>\n<h2><span id=\"Designing_an_Architecture_for_Multiple_Projects_and_Teams\">Designing an Architecture for Multiple Projects and Teams<\/span><\/h2>\n<p>Plan a model for several projects and teams, then implement and test one project at a time. The corporate, API and shop names below illustrate inventory; the complete executable recipe uses shop so its accounts, paths, ACLs and sudo rules can be followed without hidden prerequisites.<\/p>\n<h3><span id=\"Step_1_Map_your_reality\">Step 1: Map your reality<\/span><\/h3>\n<p>In a quick planning session, list the things you need to represent on the server:<\/p>\n<ul>\n<li><strong>Projects:<\/strong> For example <code>corporate\u2011site<\/code>, <code>api\u2011backend<\/code>, <code>shop\u2011frontend<\/code>.<\/li>\n<li><strong>Environments:<\/strong> Production, staging, sometimes development.<\/li>\n<li><strong>Teams and roles:<\/strong> Who deploys? Who only reads logs? Who manages databases?<\/li>\n<li><strong>External parties:<\/strong> Any agencies or freelancers that should only touch one project?<\/li>\n<\/ul>\n<p>Use this inventory to define the actual accounts, file permissions and sudo rules. Test the resulting grants against the access each person needs.<\/p>\n<h3><span id=\"Step_2_Define_user_types\">Step 2: Define user types<\/span><\/h3>\n<p>We recommend three main types of accounts on the VPS:<\/p>\n<ul>\n<li><strong>Personal users:<\/strong> one per person, with individual keys and traceable task grants.<\/li>\n<li><strong>Deployment identities:<\/strong> one per project\/environment; own published code and perform release tasks.<\/li>\n<li><strong>Runtime identities:<\/strong> one per relevant isolation boundary, without write permission to their code. Shared package users such as nginx do not create project isolation by themselves.<\/li>\n<\/ul>\n<p>Separate personal and deployment users so code ownership can remain stable when a team member leaves. Offboarding still requires a review of owned files, active processes and credentials; release history and rollback need their own deployment controls.<\/p>\n<p>Separate deployment identities for prod and stage as well: a single account owning both trees can cross the boundary even if their group names differ.<\/p>\n<h3><span id=\"Step_3_Define_group_types\">Step 3: Define group types<\/span><\/h3>\n<p>Next, define groups that mirror your projects and roles:<\/p>\n<ul>\n<li><strong>Project groups:<\/strong> One per project per environment, e.g. <code>g_corp_prod<\/code>, <code>g_corp_stage<\/code>, <code>g_api_prod<\/code>.<\/li>\n<li><strong>Role groups for sudo:<\/strong> <code>sudo_web<\/code> (web stack operations), <code>sudo_db<\/code> (DB ops), <code>sudo_ops<\/code> (full operations).<\/li>\n<li><strong>Optional team groups:<\/strong> If you have large teams, you can add <code>team_front<\/code>, <code>team_back<\/code> etc. Standard local Unix groups do not nest: add each user to the required project groups, manually or through automation. For most small VPS setups, project groups alone are enough.<\/li>\n<\/ul>\n<p>In practice, a developer\u2019s Unix account will end up looking like:<\/p>\n<ul>\n<li>Personal primary group, such as alice.<\/li>\n<li>Only the project read\/write and operations groups explicitly needed; the worked example uses proj_shop, shop_read and shop_ops.<\/li>\n<li>No automatic nesting or intersection: being in both a project and a generic role does not create a new restricted policy.<\/li>\n<\/ul>\n<h3><span id=\"Step_4_Plan_directory_layout\">Step 4: Plan directory layout<\/span><\/h3>\n<p>A predictable directory structure makes permissions much easier to reason about. A common and clean pattern is:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">\/srv\/\n  corp-site\/\n    prod\/\n      app\/      # code\n      shared\/   # uploads, cache, logs\n    stage\/\n      app\/\n      shared\/\n  api-backend\/\n    prod\/\n      app\/\n      shared\/\n<\/code><\/pre>\n<p>Give each project\/environment its own ownership and access policy, and check traversal on every parent directory. Separating only the prod\/stage leaf group is insufficient if a shared owner\/runtime identity can reach both. Nginx site filenames help naming consistency, but do not enforce Unix or sudo access boundaries.<\/p>\n<h3><span id=\"Step_5_Decide_your_sudo_policy\">Step 5: Decide your sudo policy<\/span><\/h3>\n<p>Finally, write down who should be able to do what with elevated privileges. A minimal but practical set:<\/p>\n<ul>\n<li>Developers: edit\/deploy only their approved project\/environment using a restricted deployment identity.<\/li>\n<li>Project operations: exact service\/log tasks for a dedicated unit; shared nginx\/PHP-FPM\/Supervisor operations affect every consumer.<\/li>\n<li>A separate, tightly controlled administrative role: full host management and recovery where justified. A project role must not quietly inherit it.<\/li>\n<\/ul>\n<p>We will implement this with role\u2011based sudo groups in a moment.<\/p>\n<h2><span id=\"Concrete_Example_One_VPS_Three_Projects_Two_Teams\">Concrete Example: One VPS, Three Projects, Two Teams<\/span><\/h2>\n<p>Imagine a VPS at dchost.com hosting three applications for a small company. These are access-inventory examples; the later shop recipe demonstrates the permissions with a synthetic static page and does not install all three application stacks:<\/p>\n<ul>\n<li><strong>Corporate website:<\/strong> WordPress at <code>corp.example.com<\/code><\/li>\n<li><strong>API backend:<\/strong> Laravel at <code>api.example.com<\/code><\/li>\n<li><strong>Shop frontend:<\/strong> Next.js at <code>shop.example.com<\/code><\/li>\n<\/ul>\n<p>Two teams work on it: Web (WordPress + frontend) and Backend (API + some WordPress integration).<\/p>\n<h3><span id=\"Users\">Users<\/span><\/h3>\n<p>Conceptually each project has personal, deployment and runtime identities. For the complete shop example, use the same five named accounts throughout:<\/p>\n<ul>\n<li><code>alice<\/code>: code\/shared writer through <code>proj_shop<\/code>, log reader through <code>shop_read<\/code>.<\/li>\n<li><code>bob<\/code>: only <code>shop_read<\/code>; reads code\/logs, without access to shared data.<\/li>\n<li><code>carol<\/code>: selected service operations through <code>shop_ops<\/code>, reading through <code>shop_read<\/code>; no automatic code-write permission.<\/li>\n<li><code>deploy_shop<\/code>: code owner and target of a limited local maintenance task. <code>svc_shop<\/code>: separate runtime identity that can read code but cannot change it.<\/li>\n<\/ul>\n<h3><span id=\"Groups\">Groups<\/span><\/h3>\n<ul>\n<li>Conceptual project\/environment groups: g_corp_prod, g_corp_stage, g_api_prod, g_shop_prod; names are examples rather than created objects.<\/li>\n<li>Executable shop recipe: proj_shop for writers, shop_read for code\/log readers and shop_ops for project operations.<\/li>\n<li>A global administrator role is separate; database access also requires actual database grants.<\/li>\n<\/ul>\n<h3><span id=\"Directory_ownership\">Directory ownership<\/span><\/h3>\n<p>We may decide:<\/p>\n<ul>\n<li>Code: a deployment account owns the app tree; normal files are not assigned executable\/setgid bits recursively.<\/li>\n<li>Runtime: a separate account reads code and writes only the application\u2019s necessary mutable paths.<\/li>\n<li>Readers\/writers: actual permissions and ACLs implement the access matrix; a read-only role cannot cancel membership in a writer group.<\/li>\n<\/ul>\n<p>Directory setgid gives newly created objects the directory group; it does not grant write access by itself. Regular files are not made executable recursively. The ACL grants code read\/search access to <code>svc_shop<\/code> and <code>shop_read<\/code>, while <code>proj_shop<\/code> can write. The <code>mask<\/code> limits effective named-user\/group and owning-group permissions. <code>chmod g=...<\/code> can change that mask; inspecting the group entry alone is insufficient.<\/p>\n<p>With a default directory ACL, the inherited ACL and the application\u2019s requested creation mode determine a new file\u2019s permissions. An explicit <code>0600<\/code> mode can remove effective reader access. Copying, extraction, editor replacement\/rename and deployment tools may alter or omit ACLs. The example explicitly restores the index file ACL after <code>install<\/code> for this reason. Verify effective access after each real deployment.<\/p>\n<p><a href=\"https:\/\/manpages.ubuntu.com\/manpages\/noble\/man5\/acl.5.html\" rel=\"nofollow noopener\" target=\"_blank\">The POSIX ACL manual<\/a> documents creation and access-check semantics.<\/p>\n<h3><span id=\"Group_membership\">Group membership<\/span><\/h3>\n<p>We might assign group membership like this:<\/p>\n<ul>\n<li><code>alice<\/code>: code\/shared writer through <code>proj_shop<\/code>, log reader through <code>shop_read<\/code>.<\/li>\n<li><code>bob<\/code>: only <code>shop_read<\/code>; reads code\/logs, without access to shared data.<\/li>\n<li><code>carol<\/code>: selected service operations through <code>shop_ops<\/code>, reading through <code>shop_read<\/code>; no automatic code-write permission.<\/li>\n<li><code>deploy_shop<\/code>: code owner and target of a limited local maintenance task. <code>svc_shop<\/code>: separate runtime identity that can read code but cannot change it.<\/li>\n<\/ul>\n<p>The code owner is deploy_shop, while svc_shop only receives named ACL access to code. Do not add the runtime identity to a code-writer group. Real CI credentials and artifact publication require a separate reviewed design; the local fixed task below is not a full deployment pipeline.<\/p>\n<h3><span id=\"sudo_rules\">sudo rules<\/span><\/h3>\n<p>We then declare in <code>\/etc\/sudoers.d\/<\/code> (details in the next section):<\/p>\n<ul>\n<li>proj_shop: the fixed release-check task as deploy_shop, with no extra arguments.<\/li>\n<li>shop_ops: exact restart\/log commands for shop.service, not arbitrary shared web-stack or database clients.<\/li>\n<li>A separate administrative group may intentionally have full host privilege; it is not created by this project exercise.<\/li>\n<\/ul>\n<p>The resulting policy can be explained and tested, but its safety depends on all effective grants and on protected service\/configuration paths. Naming groups or passing visudo does not itself establish an isolated or auditable deployment.<\/p>\n<h2><span id=\"Implementing_the_Design_StepbyStep_on_Linux\">Implementing the Design Step\u2011by\u2011Step on Linux<\/span><\/h2>\n<p>Implement the shop example first, then repeat with distinct identities and paths for the corporate\/API projects and their environments. The following prerequisites and commands are complete for the account\/permission exercise, not for production application deployment.<\/p>\n<h3><span id=\"1_Create_Project_Groups_and_Required_Accounts\">1. Create Project Groups and Required Accounts<\/span><\/h3>\n<p>This worked example targets Ubuntu 24.04 with a POSIX shell, shadow user tools, sudo and the <code>acl<\/code> package. Start on a separate test server; do not apply it wholesale to existing accounts or a populated project tree. Run the setup commands as an administrator\/root. Account names and <code>\/srv\/shop<\/code> must be new; the example stops on existing names. Enroll human SSH keys, the intended password\/PAM policy and recovery access separately. Creating an account does not prove that login works.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">#!\/bin\/sh\nset -eu\nfor account in alice bob carol deploy_shop svc_shop; do\n    if getent passwd &quot;$account&quot; &gt;\/dev\/null; then\n        printf &#039;Account already exists: %s\\n&#039; &quot;$account&quot; &gt;&amp;2\n        exit 1\n    fi\ndone\nfor team in proj_shop shop_read shop_ops; do\n    if getent group &quot;$team&quot; &gt;\/dev\/null; then\n        printf &#039;Group already exists: %s\\n&#039; &quot;$team&quot; &gt;&amp;2\n        exit 1\n    fi\ndone\ngroupadd proj_shop\ngroupadd shop_read\ngroupadd shop_ops\nuseradd -m -U -s \/bin\/bash alice\nuseradd -m -U -s \/bin\/bash bob\nuseradd -m -U -s \/bin\/bash carol\nuseradd -r -M -U -d \/nonexistent -s \/usr\/sbin\/nologin deploy_shop\nuseradd -r -M -U -d \/nonexistent -s \/usr\/sbin\/nologin svc_shop\nusermod -aG proj_shop,shop_read alice\nusermod -aG shop_read bob\nusermod -aG shop_ops,shop_read carol\n<\/code><\/pre>\n<h3><span id=\"2_Verify_Personal_Accounts_and_Membership\">2. Verify Personal Accounts and Membership<\/span><\/h3>\n<p>The script creates the personal users as well as the project groups. Verify the resulting database records, then enroll and test their intended authentication before changing remote-access policy.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">getent passwd alice bob carol deploy_shop svc_shop\n<\/code><\/pre>\n<p>The -aG form appends supplementary memberships; -G without -a removes memberships omitted from the list. The script has already applied the required groups. Check the records, then verify the groups in a fresh login session.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">id alice\nid bob\nid carol\n<\/code><\/pre>\n<p>For SSH best practices (keys instead of passwords, no direct root login), pair this with the approach from our article on <a href=\"https:\/\/www.dchost.com\/blog\/en\/ssh-key-management-and-access-sharing-secure-vps-login-architecture-for-small-teams\/\">SSH key management and access sharing for small teams<\/a>.<\/p>\n<h3><span id=\"3_Separate_Local_Runtime_Tasks_from_CI_Login\">3. Separate Local Runtime Tasks from CI Login<\/span><\/h3>\n<p>The example\u2019s deploy_shop and svc_shop are local task\/runtime identities with nologin shells. They do not accept ordinary SSH command deployment. OpenSSH normally invokes the account login shell even for a forced command; nologin exits unsuccessfully.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">getent passwd deploy_shop svc_shop\n<\/code><\/pre>\n<p>If remote CI needs SSH, design a separate automation identity with an appropriate executable shell and a reviewed fixed command, restricted key options, source restrictions where applicable and credential rotation. A forced command alone does not disable forwarding; review restrict\/no-pty and the effective sshd policy. Validate inputs such as SSH_ORIGINAL_COMMAND rather than passing them to an arbitrary shell. No CI SSH account is configured by this recipe.<\/p>\n<h3><span id=\"4_Set_Code_Data_and_Log_Permissions\">4. Set Code, Data and Log Permissions<\/span><\/h3>\n<p>Create a fresh shop tree. Existing production trees require a separate ownership\/ACL\/symlink inventory and migration plan; do not recursively overwrite their modes.<\/p>\n<p>The complete setup separates <code>\/srv\/shop\/prod\/app<\/code>, <code>shared<\/code> and <code>logs<\/code>. Parent directories permit traversal; leaf directories enforce access to project content. The deployment account owns code, while writable application data stays separate. The synthetic <code>index.html<\/code> is only an exercise fixture.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">#!\/bin\/sh\nset -eu\nif [ -e \/srv\/shop ] || [ -L \/srv\/shop ]; then\n    printf &#039;%s\\n&#039; &#039;\/srv\/shop already exists; review it instead of overwriting permissions.&#039; &gt;&amp;2\n    exit 1\nfi\ninstall -d -o root -g root -m 0755 \/srv\/shop \/srv\/shop\/prod\ninstall -d -o deploy_shop -g proj_shop -m 2770 \/srv\/shop\/prod\/app\ninstall -d -o svc_shop -g proj_shop -m 2770 \/srv\/shop\/prod\/shared\ninstall -d -o svc_shop -g shop_read -m 2750 \/srv\/shop\/prod\/logs\n\nsetfacl -m u:svc_shop:rx,g:shop_read:rx,m::rwx \/srv\/shop\/prod\/app\nsetfacl -d -m u::rwx,u:svc_shop:rx,g::rwx,g:shop_read:rx,m::rwx,o::--- \/srv\/shop\/prod\/app\nsetfacl -m u:svc_shop:rwx,m::rwx \/srv\/shop\/prod\/shared\nsetfacl -d -m u::rwx,u:svc_shop:rwx,g::rwx,m::rwx,o::--- \/srv\/shop\/prod\/shared\nsetfacl -d -m u::rwx,g::rx,m::rx,o::--- \/srv\/shop\/prod\/logs\n\ninstall -o deploy_shop -g proj_shop -m 0660 \/dev\/null \/srv\/shop\/prod\/app\/index.html\nprintf &#039;%s\\n&#039; &#039;&lt;!doctype html&gt;&lt;title&gt;Shop preview&lt;\/title&gt;&lt;p&gt;Synthetic tutorial page.&lt;\/p&gt;&#039; &gt; \/srv\/shop\/prod\/app\/index.html\nsetfacl -m u:svc_shop:r,g:shop_read:r,m::rw \/srv\/shop\/prod\/app\/index.html\n<\/code><\/pre>\n<p>The intended matrix is now concrete; verify it rather than infer it from a directory name or one numeric mode:<\/p>\n<p>Verify the synthetic example from an administrative session. The first two reads should succeed; the last two writes should be denied. Unexpected success can indicate an additional broad group, sudo or ACL grant.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">getfacl -p \/srv\/shop\/prod\/app \/srv\/shop\/prod\/app\/index.html\nsudo -u bob -- cat \/srv\/shop\/prod\/app\/index.html\nsudo -u svc_shop -- cat \/srv\/shop\/prod\/app\/index.html\nsudo -u bob -- touch \/srv\/shop\/prod\/app\/bob-must-not-write\nsudo -u svc_shop -- touch \/srv\/shop\/prod\/app\/runtime-must-not-write\n<\/code><\/pre>\n<p>Adding\/removing a group does not retroactively replace supplementary groups in existing processes. Validate grants in a new session; during revocation also inspect live sessions, processes, user-owned files and other credentials. <code>id bob<\/code> queries account data; <code>id<\/code> inside an old session may show a different group set. Membership in a reader group does not revoke write permission obtained from a writer group.<\/p>\n<h3><span id=\"5_Verify_File-Creation_Policy\">5. Verify File-Creation Policy<\/span><\/h3>\n<p>Keep creation policy local to the relevant shell, service or application. A global interactive profile edit does not configure every daemon, and may broaden permissions for unrelated users.<\/p>\n<p>Without a default ACL, a file requested with mode <code>0666<\/code> becomes <code>0664<\/code> under <code>umask 0002<\/code> and <code>0660<\/code> under <code>umask 0007<\/code>. Umask removes permissions; it does not add them or change existing files. The command below affects only the current shell and its children. Do not change the server-wide <code>\/etc\/profile.d<\/code> policy merely for this exercise. Review each service\u2019s <code>UMask=<\/code> and default-ACL behavior separately.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">umask 0007\n<\/code><\/pre>\n<p>The explicit mode requested by an application, inherited ACL and later chmod\/copy\/rename operations still matter. Recheck effective permissions after deployment and when the application changes its file-creation behavior.<\/p>\n<h3><span id=\"6_Install_Exact_sudo_Rules\">6. Install Exact sudo Rules<\/span><\/h3>\n<p>Use a separate included file, but verify that the main sudoers file includes its directory. Edit with visudo, then validate the complete configuration and check actual allowed\/denied commands. First install the fixed nonroot task:<\/p>\n<p>Do not execute developer-controlled builds, deployment code or migrations as root. For a limited <code>RunAs<\/code> example, save the following as <code>shop-check<\/code>. It only computes a fixed file\u2019s SHA-256; it does not deploy code or establish that the file is trusted. A real deployment still needs artifact verification, an atomic switch and rollback design.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">#!\/bin\/sh\nset -eu\nif [ &quot;$#&quot; -ne 0 ]; then\n    printf &#039;%s\\n&#039; &#039;No arguments are accepted.&#039; &gt;&amp;2\n    exit 2\nfi\nexec \/usr\/bin\/sha256sum -- \/srv\/shop\/prod\/app\/index.html\n<\/code><\/pre>\n<p>After reviewing its contents, install it as an administrator\/root. Protect the file and every parent directory against replacement by the users receiving permission:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">install -d -o root -g root -m 0755 \/usr\/local\/libexec\ninstall -o root -g root -m 0755 .\/shop-check \/usr\/local\/libexec\/shop-check\nvisudo -f \/etc\/sudoers.d\/shop\n<\/code><\/pre>\n<h4><span id=\"Project-scoped_operations\">Project-scoped operations<\/span><\/h4>\n<p>The included file is <code>\/etc\/sudoers.d\/shop<\/code>; it must have trusted ownership and restrictive permissions. Validate the main configuration after editing it.<\/p>\n<p>Use exact executable paths and arguments. The following groups are created by the account recipe:<\/p>\n<p>This file is scoped to one project. <code>shop_ops<\/code> is an explicitly project-scoped group; a generic operations group does not automatically intersect project membership. Verify actual executable paths and avoid dots\/backup suffixes in the include filename:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">User_Alias SHOP_DEVS = %proj_shop\nUser_Alias SHOP_OPS = %shop_ops\nCmnd_Alias SHOP_VERIFY = \/usr\/local\/libexec\/shop-check &quot;&quot;\nCmnd_Alias SHOP_RESTART = \/usr\/bin\/systemctl restart shop.service\nCmnd_Alias SHOP_LOGS = \/usr\/bin\/journalctl --no-pager --unit shop.service --lines 100\n\nSHOP_DEVS ALL=(deploy_shop) NOPASSWD: SHOP_VERIFY\nSHOP_OPS ALL=(root) SHOP_RESTART, SHOP_LOGS\n<\/code><\/pre>\n<ul>\n<li>This rule grants <code>proj_shop<\/code> only the fixed <code>shop-check<\/code> task as <code>deploy_shop<\/code>. The trailing <code>\"\"<\/code> prohibits arguments; omitting arguments from a sudoers command generally allows arbitrary arguments.<\/li>\n<li><code>shop_ops<\/code> may run only the exact restart\/log commands as root. No command-argument wildcards are used; additional units or options fall outside the rule.<\/li>\n<li><code>--no-pager<\/code> avoids an interactive pager, but log contents may still be sensitive. The line limit and unit selection do not replace data-access policy.<\/li>\n<li>Only the limited nonroot task has <code>NOPASSWD<\/code>. Service operations use the default authentication policy; cached credentials and other rules mean a fresh password prompt is not guaranteed every time.<\/li>\n<li>Other sudoers files, polkit rules, groups\/ACLs and executable behavior contribute to effective privilege. This fragment does not prove that users have no other root path.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/manpages.ubuntu.com\/manpages\/noble\/man5\/sudoers.5.html\" rel=\"nofollow noopener\" target=\"_blank\">The sudoers manual\u2019s<\/a> argument, RunAs and include rules define these boundaries.<\/p>\n<p>Check the complete configuration; parsing one file alone may miss conflicting aliases or wider grants elsewhere. The following <code>-l<\/code> checks do not execute the commands. The first two authorization queries should succeed and the final one should be denied:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">chown root:root \/etc\/sudoers.d\/shop\nchmod 0440 \/etc\/sudoers.d\/shop\nvisudo -c\nsudo -l -U alice -u deploy_shop \/usr\/local\/libexec\/shop-check\nsudo -l -U carol \/usr\/bin\/systemctl restart shop.service\nsudo -l -U bob \/usr\/bin\/systemctl restart shop.service\n<\/code><\/pre>\n<p>Then, in an alice session, <code>sudo -u deploy_shop \/usr\/local\/libexec\/shop-check<\/code> should work; an extra argument or <code>-u root<\/code> must be denied. Test the task\u2019s behavior and file permissions as well: <code>visudo<\/code> does not prove them.<\/p>\n<p>Restart permission affects every project served by that unit. Restarting shared <code>nginx<\/code>, PHP-FPM or Supervisor is not project isolation. A project boundary needs a separate unit and runtime identity, with shared dependencies reviewed separately. Protect the unit, drop-ins, ExecStartPre\/ExecStart\/ExecReload chain, scripts, critical configuration and their parent directories against writes by delegated users. systemd command prefixes such as <code>+<\/code>\/<code>!<\/code> can change credential boundaries.<\/p>\n<p>The optional <code>shop.service<\/code> below exposes the synthetic page only on localhost in an isolated exercise. <a href=\"https:\/\/docs.python.org\/3.12\/library\/http.server.html\" rel=\"nofollow noopener\" target=\"_blank\">Python http.server<\/a> is not recommended for production. For this optional section, first confirm that the target has an executable <code>\/usr\/bin\/python3<\/code> and the <code>http.server<\/code> module; minimal images may omit them. If needed, install the distribution\u2019s supported Python 3 packages on the test server. Configure an appropriate application server, dependencies, access controls, health checks and rollback for a real workload; this permission exercise is not a production architecture.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">[Unit]\nDescription=Shop static preview for an isolated tutorial\nAfter=network.target\n\n[Service]\nType=simple\nUser=svc_shop\nGroup=svc_shop\nWorkingDirectory=\/srv\/shop\/prod\/app\nExecStart=\/usr\/bin\/python3 -m http.server 18080 --bind 127.0.0.1 --directory \/srv\/shop\/prod\/app\nUMask=0027\nNoNewPrivileges=yes\nPrivateTmp=yes\nProtectHome=yes\nProtectSystem=strict\nReadOnlyPaths=\/srv\/shop\/prod\/app\nReadWritePaths=\/srv\/shop\/prod\/shared \/srv\/shop\/prod\/logs\n\n[Install]\nWantedBy=multi-user.target\n<\/code><\/pre>\n<p>Install the file as root:root, mode 0644, at <code>\/etc\/systemd\/system\/shop.service<\/code>. Inspect and resolve every diagnostic from <code>systemd-analyze verify \/etc\/systemd\/system\/shop.service<\/code>; its default exit status alone is insufficient. Then start it only on the test server with <code>systemctl daemon-reload<\/code> and <code>systemctl start shop.service<\/code>, then check actual process credentials, read\/write behavior and the localhost response. Syntax acceptance is not a running-service test. With <code>Type=simple<\/code>, a successful start result alone also does not prove that Python ran or answered HTTP. <code>ProtectSystem=strict<\/code> and writable exclusions do not replace Unix permissions; <code>PrivateTmp<\/code> also provides private temporary writable storage. Do not read <code>ReadWritePaths<\/code> as an absolute boundary for every filesystem interaction.<\/p>\n<p><a href=\"https:\/\/www.freedesktop.org\/software\/systemd\/man\/255\/systemd.exec.html\" rel=\"nofollow noopener\" target=\"_blank\">The systemd.exec documentation<\/a> details User, UMask and filesystem restrictions. Checking syntax and equivalent process permissions does not validate the running service; test service startup, SSH connections and production-load acceptance separately.<\/p>\n<h4><span id=\"Database_Tasks_and_Privilege_Boundaries\">Database Tasks and Privilege Boundaries<\/span><\/h4>\n<p>Keep database authorization separate from the project service rule. An interactive SQL client is not a constrained root maintenance operation.<\/p>\n<p>For a real backup task, define both OS and database permissions and protect its output. For example:<\/p>\n<p>Design database authorization separately. Do not allow interactive <code>mysql<\/code>\/<code>psql<\/code> clients or generic dump tools as root with arbitrary arguments: shell, file and connection capabilities can expand the OS privilege boundary. A backup needs a restricted OS identity, appropriate database role, output-file controls and retention policy. If a named connection service has already been configured for your actual system, the account may invoke it as follows:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">umask 0077\npg_dump --dbname=service=shop_backup --format=custom --file=&quot;$HOME\/shop.dump&quot;\n<\/code><\/pre>\n<p>This command does not presume root access; the <a href=\"https:\/\/www.postgresql.org\/docs\/17\/libpq-pgservice.html\" rel=\"nofollow noopener\" target=\"_blank\">shop_backup connection service<\/a> is not created by this tutorial. TLS, authentication, database\/schema\/table privileges, output capacity and restore testing are separate prerequisites. A role name grants no privilege by itself, and a single-database dump does not back up cluster-wide roles\/tablespaces. Validate dump\/restore separately in your own test environment.<\/p>\n<p>A password prompt does not turn an unrestricted database client into a safe root sandbox. Reduce the target identity and task scope first, then define the required authentication policy.<\/p>\n<h4><span id=\"Ops_full_admin_sudo_rules\">Ops \/ full admin sudo rules<\/span><\/h4>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">visudo -f \/etc\/sudoers.d\/global-ops\n<\/code><\/pre>\n<p>Only for a separately created and carefully controlled global_ops group, the following grants full host administration. It is not part of the shop exercise and is not a restricted web\/DB role:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">%global_ops ALL=(ALL:ALL) ALL\n<\/code><\/pre>\n<p>Limit and review global_ops membership and retain tested recovery access. Its members can become root; the project rules cannot constrain them. Account locking or group removal alone may leave existing processes, sessions or other credentials active.<\/p>\n<h3><span id=\"7_Tie_it_into_your_security_hardening\">7. Tie it into your security hardening<\/span><\/h3>\n<p>User, group and sudo design does not live in a vacuum. It should be part of a broader server security baseline: SSH hardening, firewall rules, automatic updates and log monitoring. Our <a href=\"https:\/\/www.dchost.com\/blog\/en\/vps-ssh-hardening\/\">VPS security hardening checklist with sshd_config, Fail2ban and disabling root SSH<\/a> goes through these steps in detail and complements the architecture we have just built.<\/p>\n<h2><span id=\"Security_Best_Practices_and_Common_Pitfalls\">Security Best Practices and Common Pitfalls<\/span><\/h2>\n<p>Review these permission and lifecycle mistakes as the model evolves. Test negative cases as deliberately as successful access.<\/p>\n<h3><span id=\"Avoid_shared_accounts\">Avoid shared accounts<\/span><\/h3>\n<p>Sharing a <code>deploy<\/code> or <code>admin<\/code> login between people obscures attribution and complicates offboarding. Keep personal accounts for humans, and use dedicated, narrowly scoped identities for each automation boundary. Review keys, tokens, active sessions and owned files when access ends.<\/p>\n<h3><span id=\"Never_fix_permissions_with_777\">Never \u201cfix\u201d permissions with 777<\/span><\/h3>\n<p>When a web app fails with a \u201cpermission denied\u201d error, a common quick\u2011and\u2011dirty fix is to run:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">chmod -R 777 \/srv\/corp-site\/prod\n<\/code><\/pre>\n<p>This broad recursive mode permits other local users to modify the tree and adds execute bits to regular files. Repair the actual owner\/group, ACL, parent traversal and file-type requirements instead; inspect ACLs and privileged users separately. See <a href=\"https:\/\/www.dchost.com\/blog\/en\/linux-file-permissions-644-755-777-explained-for-shared-hosting-and-vps\/\">safe Linux file permissions on VPS<\/a> for context.<\/p>\n<h3><span id=\"Disable_direct_root_SSH_login\">Disable direct root SSH login<\/span><\/h3>\n<p>Before disabling direct root SSH, confirm a personal administrator\u2019s key-based login and required sudo in a second session. Keep the current administrative session, a working console\/recovery path and a configuration backup.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">PubkeyAuthentication yes\nAuthenticationMethods publickey\nPasswordAuthentication no\nKbdInteractiveAuthentication no\nPermitRootLogin no\n<\/code><\/pre>\n<p>This is a publickey-only policy, not MFA; do not replace an existing key-plus-second-factor requirement with it. Password and keyboard-interactive authentication are distinct methods. Do not blindly append directives: Include ordering and relevant Match blocks affect effective values. Review the target version with sshd -t and sshd -T plus appropriate -C connection parameters, preserve PAM account\/session controls, then apply the distribution\u2019s service\/socket procedure. Keep recovery access while testing new successful and rejected connections and sudo. A syntax check is not an SSH handshake test.<\/p>\n<h3><span id=\"Separate_staging_from_production\">Separate staging from production<\/span><\/h3>\n<p>Use separate groups and also separate deploy\/runtime identities for prod and stage. A shared owner, service account, credential or writable startup configuration can cross a group-only boundary. Test both directions and protect secrets; separate VPS instances may be appropriate where the required isolation exceeds a shared host.<\/p>\n<h3><span id=\"Combine_with_a_firewall_and_log_monitoring\">Combine with a firewall and log monitoring<\/span><\/h3>\n<p>Combine the account design with SSH policy, a reviewed firewall and log monitoring. These controls address different paths; none makes the others irrelevant. Our <a href=\"https:\/\/www.dchost.com\/blog\/en\/vps-firewall-configuration\/\">VPS firewall guide<\/a> provides related network controls.<\/p>\n<h2><span id=\"Scaling_the_Model_From_One_VPS_to_Many\">Scaling the Model: From One VPS to Many<\/span><\/h2>\n<p>Reuse the naming and policy structure as you add hosts, while validating each host\u2019s effective accounts, IDs, paths, application and operational requirements.<\/p>\n<h3><span id=\"Standardise_your_pattern\">Standardise your pattern<\/span><\/h3>\n<p>Once you are happy with the layout on one VPS, document your conventions:<\/p>\n<ul>\n<li>Project\/environment account and group naming.<\/li>\n<li>Separate deployment and runtime ownership plus mutable data paths.<\/li>\n<li>Actual sudo command\/RunAs rules and their trusted dependencies.<\/li>\n<li>Permission\/ACL verification, rollback, offboarding and review owners.<\/li>\n<\/ul>\n<p>Then reuse this pattern on every new VPS or <a href=\"https:\/\/www.dchost.com\/dedicated-server\">dedicated server<\/a> you provision at dchost.com. Consistency makes troubleshooting and onboarding much easier.<\/p>\n<h3><span id=\"Automate_with_Ansible_and_Terraform\">Automate with Ansible and Terraform<\/span><\/h3>\n<p>Manually running <code>useradd<\/code>, <code>groupadd<\/code> and <code>chown<\/code> is fine for the first server. When you have several, you will want automation. A common pattern:<\/p>\n<ul>\n<li>Use Terraform or a similar tool with a supported provider or provisioning integration to create the required hosts.<\/li>\n<li>Use Ansible to configure users, groups, sudoers, directories and permissions from structured project, environment and team data.<\/li>\n<\/ul>\n<p>Our guide to <a href=\"https:\/\/www.dchost.com\/blog\/en\/terraform-ansible-vps-automation\/\">automating VPS setup with Terraform and Ansible<\/a> explains this division of work. Keep syntax checks, access tests, rollback and drift review alongside the configuration.<\/p>\n<h3><span id=\"Consider_central_authentication_for_larger_teams\">Consider central authentication for larger teams<\/span><\/h3>\n<p>For larger fleets, a managed directory, LDAP\/FreeIPA and clients such as SSSD may centralize identity and policy. Integration, local fallback, cache expiry, nested-group behavior and revocation depend on the selected system; local Unix group files do not gain nesting automatically. Test outages and removed-user access rather than assume changes are pushed instantly to every process.<\/p>\n<h2><span id=\"A_Maintainable_VPS_Access_Model\">A Maintainable VPS Access Model<\/span><\/h2>\n<p>A useful access model identifies who can read code, publish a release, change runtime data or operate a service, and under which identity. Keep one reviewed policy and acceptance matrix per project\/environment. Rerun relevant permission and authorization checks after account, deployment-tool, unit or application changes; also review the logs needed to attribute operations.<\/p>\n<p>For a new project or hosting migration, record these requirements before granting access. Pair this model with the <a href=\"https:\/\/www.dchost.com\/blog\/en\/vps-ssh-hardening\/\">VPS hardening checklist<\/a> and, where needed, <a href=\"https:\/\/www.dchost.com\/blog\/en\/terraform-ansible-vps-automation\/\">Terraform and Ansible automation<\/a>. Confirm the management responsibilities included in the service you buy. Personal accounts and scoped commands help make access reviewable; they do not promise complete isolation or a full audit trail by themselves.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Build a clear Linux VPS access model with personal accounts, separate deployment\/runtime identities, ACL checks and exact sudo rules for one project.<\/p>\n","protected":false},"author":1,"featured_media":12982,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[184],"tags":[],"class_list":["post-3680","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/3680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/comments?post=3680"}],"version-history":[{"count":5,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/3680\/revisions"}],"predecessor-version":[{"id":12984,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/3680\/revisions\/12984"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/media\/12982"}],"wp:attachment":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/media?parent=3680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/categories?post=3680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/tags?post=3680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}