Why Two Services on One Server Should Deploy Under Different Accounts
When a query portal and a nightly settlement job share a VM and one shared deploy account, the OS will happily allow a typo in the portal plan. A permission table that separates deploy and runtime accounts per service, the parent-directory trap, and an acceptance test.
A query portal and a nightly settlement service share one VM. The portal gets patched often, around 4 p.m. The settlement service only changes during scheduled maintenance windows. If a shared deploy account owns both release directories and both restart rights, the operating system will allow the job even when someone accidentally puts the settlement service name into the portal deploy plan.
Splitting deploy accounts for two services on the same server gives the operating system a reason to refuse when one service's deploy plan mistakenly names the other.
What does the permission table look like per service?
With separate deploy accounts, you can pin down which directories each can write and which service each can restart.
| Permission | Query portal | Nightly settlement |
|---|---|---|
| Account that requests the deploy | portal-deploy | settlement-deploy |
| Where it may write the release | Portal release directory | Settlement release directory |
| Restart it may request | Portal service | Settlement service |
| Account the business process runs as | portal-run | settlement-run |
The last row is there for a reason. The settlement app needs to read business data, but the account that places the settlement package has no need to read those business credentials itself. Linux services can specify the user and group a process runs as. Separating deploy and runtime accounts makes it easier to review which credential each job actually needs. At the same time, the right to replace settlement code has a large impact on settlement operations, so it still requires a settlement deploy approval.
Where does the separation break even with two accounts?
The common miss is the shared parent directory. Even if the portal account can't write files inside the settlement directory, the intended separation breaks if it can rename or replace the settlement release path from the parent. What matters isn't that you created two account names. It's the writes and restarts each account is actually allowed to perform.
Delegating restart rights per service is covered in Shrinking deploy agent privileges when only the restart needs root. Account separation pins down, at the OS level, which service that delegation can touch.
How do you run the acceptance test?
The acceptance test takes one deploy. Stage a new portal version with the portal account, then confirm that a write to the settlement path and a settlement restart request are each refused. Then watch the settlement batch finish on schedule. What this test proves isn't that two accounts exist. It's seeing for yourself that an afternoon portal fix cannot touch the nightly settlement job.
- #deployment
- #security
- #least-privilege
- #linux
- #vm