How to Create a Separate User Account for Each Client on One VPS

If you host websites for more than one client on the same server, sharing a single login is asking for trouble. A separate user account for each client on one VPS keeps files, processes, and mistakes apart, so one client’s broken upload or weak password never takes down everyone else’s site. This guide covers the full setup on Ubuntu 24.04: creating accounts, setting home directory permissions, wiring each account to its own web root and PHP-FPM pool, and handing out limited sudo access only when a client actually needs it.

Why One Account Per Client Beats a Shared Login

When every client shares the same user, every file on the server belongs to the same owner. A compromised WordPress plugin on one site can read or overwrite files from another site, because the web server process runs as the same user everywhere. A Linux user account per client fixes that at the operating system level: each client’s files belong to a different user, and the file permissions you set decide exactly who can read what.

Separate accounts also make real life easier. When a client leaves, you delete one user and their home directory instead of picking through a shared folder to work out which files were theirs. When something breaks, the logs show which user ran the command. And when a client asks for SFTP access, you hand them credentials that only reach their own files. If you are already hosting a client website on your VPS, separate accounts are the missing piece that keeps those sites genuinely apart.

Plan the Layout Before You Create Anything

Decide on a layout and use it for every client, so the server stays predictable as it grows. A simple pattern works well:

Item Path Owner
Home directory /home/clientname clientname
Web root /home/clientname/public_html clientname
Logs /home/clientname/logs clientname
PHP-FPM pool /etc/php/8.3/fpm/pool.d/clientname.conf root
Nginx server block /etc/nginx/sites-available/clientname root

Keeping each site under its owner’s home directory means backups, deletion, and disk usage checks all work per client with one command, and a client’s PHP processes run as their own user, which is the foundation of real vps client isolation. Adjust the PHP version in the paths above to match your server.

Create a Separate User Account for Each Client

To create a user account on a VPS, use adduser rather than the lower-level useradd. The adduser ubuntu vps workflow prompts for a password and creates the home directory in one step:

sudo adduser clientname
sudo mkdir -p /home/clientname/public_html /home/clientname/logs
sudo chown clientname:clientname /home/clientname/public_html /home/clientname/logs

The account now exists, but it can still see other users’ home directories, because the default home permission is 755. Tighten it so only the owner can enter:

sudo chmod 750 /home/clientname

That single change blocks other non-root users from listing the contents of this client’s home directory. Repeat the same three commands for every new client, swapping in their name. The process takes about a minute once you know the pattern.

Set Up SSH Key Access Instead of Passwords

Passwords get shared, reused, and guessed. If a client needs SSH or SFTP access, give them a key instead. Ask the client for their public key, then place it in their account:

sudo mkdir -p /home/clientname/.ssh
sudo nano /home/clientname/.ssh/authorized_keys
sudo chown -R clientname:clientname /home/clientname/.ssh
sudo chmod 700 /home/clientname/.ssh
sudo chmod 600 /home/clientname/.ssh/authorized_keys

With the key in place, disable password login for that account so the key is the only way in:

sudo passwd -l clientname

Locked passwords still allow key login, so the client keeps access while password guessing becomes useless. This is the same approach covered in our guide to giving someone VPS access without sharing the root password, and it applies to clients just as well as to friends.

Lock Down Permissions So Clients Cannot See Each Other

Creating accounts is only half the job. The web server still needs to read each client’s files, and the client still needs to write to them, without either side reaching into another client’s directory. The standard setup: files owned by the client, group set to the web server group.

sudo chown -R clientname:www-data /home/clientname/public_html
sudo find /home/clientname/public_html -type d -exec chmod 750 {} ;
sudo find /home/clientname/public_html -type f -exec chmod 640 {} ;

Directories get 750 and files get 640, so the web server group can read and serve files but cannot write to them, and other users on the server get nothing at all. If a client needs to upload files through WordPress, the directories WordPress writes to, usually wp-content/uploads, need group write permission:

sudo chmod 770 /home/clientname/public_html/wp-content/uploads

For the full background on how ownership and permission bits interact on a web server, read our guide to Linux file permissions for securing web roots. The common mistake here is opening everything to 777 when an upload fails. That “fix” removes the isolation you just built, so track down the real permission problem instead.

Give Each Client Their Own PHP-FPM Pool

With Nginx and PHP-FPM, a pool is the process that runs a site’s PHP code. By default, all sites share one pool running as www-data, which means one site’s PHP can read another site’s files. Create one pool per client so each site’s PHP runs as its owner’s user:

sudo cp /etc/php/8.3/fpm/pool.d/www.conf /etc/php/8.3/fpm/pool.d/clientname.conf
sudo nano /etc/php/8.3/fpm/pool.d/clientname.conf

Edit these three lines in the new pool file:

[clientname]
user = clientname
group = clientname
listen = /run/php/php8.3-fpm-clientname.sock

Then point the client’s Nginx server block at that socket:

fastcgi_pass unix:/run/php/php8.3-fpm-clientname.sock;

Reload PHP-FPM and Nginx, and the client’s site runs entirely under their own user, so a runaway script or a compromised plugin stays contained inside that one account. This pairs naturally with hosting multiple PHP websites on one VPS with separate users, which covers the same pattern for sites that are not tied to individual clients.

Sudo Access: Give Less Than You Think

Most clients never need sudo. If one does, grant a single specific command instead of full root access. Edit the sudoers file safely with visudo and add a line like this:

clientname ALL=(ALL) /bin/systemctl reload php8.3-fpm

That lets the client reload PHP-FPM after changing their pool settings, and nothing else. Never add a client to the sudo group just because they asked for “admin access” — that is effectively root, and it erases the isolation you built. If you are still setting up the server itself, our guide to creating sudo users and disabling root login covers the admin side of this in more detail.

When a Client Leaves: Remove the Account Cleanly

Offboarding is where separate accounts pay for themselves. Take a final backup first, then remove the user, their home directory, their PHP-FPM pool, and their Nginx server block:

sudo tar -czf /root/backups/clientname-final.tar.gz /home/clientname
sudo deluser --remove-home clientname
sudo rm /etc/php/8.3/fpm/pool.d/clientname.conf
sudo rm /etc/nginx/sites-available/clientname /etc/nginx/sites-enabled/clientname
sudo systemctl reload php8.3-fpm nginx

Double-check that no cron jobs or systemd timers still reference the deleted user, and that no other site’s configuration points at the removed socket.

Common Mistakes to Avoid

  • Reusing one password across clients. If one client leaks it, every account is open. Use unique passwords or, better, SSH keys.
  • Leaving home directories at 755. Any user on the server can list another client’s files. Use 750 and check it after creating each account.
  • Running all PHP pools as www-data. Separate accounts mean nothing if the PHP processes all run as the same user. One pool per client, each with its own user.
  • Granting full sudo “temporarily”. Temporary access has a habit of becoming permanent. Grant one command at a time and review the sudoers file every few months.
  • Forgetting the cleanup. An abandoned account with a valid key is an open door. Remove accounts the same week a client leaves, not months later.

Frequently Asked Questions

Can two clients share one user account if they trust each other?

They can, but there is no reason to. Creating a second account takes a minute, and sharing one means you can never revoke one client’s access without affecting the other.

Does each client need their own PHP version?

No. Separate pools can share the same PHP version. Only create a second PHP version when a client genuinely needs an older or newer one for compatibility.

How many client accounts can one VPS hold?

Dozens, comfortably, on a small VPS. Accounts cost almost nothing; the real limit is RAM and CPU, since each PHP-FPM pool holds idle workers. Keep per-pool worker counts low and watch memory as you add clients.

A separate user account for each client on one VPS is a small amount of setup that prevents a whole category of problems: cross-client file access, messy offboarding, and one compromised site taking down the rest. Create the account, lock the permissions, give it its own PHP-FPM pool, and hand out sudo one command at a time.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.