IPv4 & IPv6 Leasing - Any RIR, Any LocationOrder Now
Hostperl

Reseller Account Isolation on FreeBSD for Agencies

By Raman Kumar

Share:

Updated on Dec 1, 2026

Reseller Account Isolation on FreeBSD for Agencies

Why reseller account isolation matters on a FreeBSD host

If you run agency or reseller hosting, the first production problem is usually account separation, not performance. One compromised mailbox, one leaked password, or one sloppy file permission should not spill into every client site you manage.

This tutorial shows how to build reseller account isolation on a FreeBSD server with jails, PF firewall rules, separate service accounts, and a clear rollback path. The goal is practical: keep customer sites, logs, and admin access separated so support stays manageable and incidents stay contained. If you are planning a new managed hosting stack on Hostperl, this is the kind of operational discipline that keeps migrations and launches calm. See dedicated server hosting for workloads that need stronger isolation than a small shared VPS can provide.

You will start from a fresh SSH login, confirm the OS, create a non-root administrator, enable jails, place each customer in its own jail, and verify that one account cannot touch another. This is a FreeBSD-specific procedure because the isolation model uses jail, rc.conf, pf, and freebsd-update.

Before you start

  • Supported platform: FreeBSD 14.2-RELEASE or later.
  • Access: root SSH access to the server.
  • Goal: isolate reseller or agency customer environments, not build a generic demo box.
  • Domain and reverse proxy details are optional here; this tutorial focuses on account separation and service containment.

Keep your original root session open until the new admin login works. Do not remove root access until you have tested the alternate account and confirmed sudo-equivalent administration works as expected on your setup.

Connect to the server and confirm FreeBSD

On your local computer, open an SSH session to the server.

ssh root@203.0.113.10

203.0.113.10 is a reserved documentation address. Replace it with the public IP assigned to your FreeBSD server.

After you connect, confirm the operating system.

freebsd-version

You should see a FreeBSD release such as 14.2-RELEASE. If the server is not FreeBSD, stop here and use the correct operating-system guide.

Create a non-root admin for ongoing support

For reseller and agency work, do not handle routine maintenance as root. Create a named admin account first.

On the VPS as root, create the deploy account and set its password.

pw useradd deploy -m -s /bin/sh -G wheel
passwd deploy

This creates a home directory and adds the account to the wheel group, which is the standard path for privileged access on FreeBSD. Use a strong password, then keep the root session open.

Now create the SSH directory and install your public key for passwordless access.

mkdir -p /home/deploy/.ssh
chmod 700 /home/deploy/.ssh
cat > /home/deploy/.ssh/authorized_keys <<'EOF'
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExampleKeyReplaceThisWithYourRealKey deploy@example.com
EOF
chmod 600 /home/deploy/.ssh/authorized_keys
chown -R deploy:deploy /home/deploy/.ssh

Replace the sample key with your real public key. The permissions matter. If they are too open, SSH may refuse to use the file.

On your local computer, open a second terminal and test the new account before changing anything else.

ssh deploy@203.0.113.10

Once you are in, test privilege escalation.

su -
whoami

Enter the deploy password when prompted. You should end up with root after switching. If that does not work, fix the account before proceeding.

Update FreeBSD and install the base tools

FreeBSD uses freebsd-update for base system patches and pkg for software packages. Do both before building the isolation layer.

On the VPS as root, update the base system.

freebsd-update fetch install

Then refresh the package catalog and install the utilities used in this tutorial.

pkg update
pkg install -y sudo pf curl vim

You will not use Linux package managers here. On FreeBSD, pkg is the correct tool and the service model is different from systemd.

Enable time synchronization so logs and audit trails stay consistent.

sysrc ntpd_enable=YES
service ntpd start

Check that the service is active.

service ntpd status

Enable PF firewall for jail traffic

Jails are much easier to run safely when the firewall rules are explicit. The safest sequence is to load the new rules first, test them, and only then rely on them at boot.

Create a baseline pf.conf that allows SSH and common web traffic, while giving the jail interface its own internal network. In this example, the host uses em0 and the jails use lo1 with 10.10.10.0/24. Adjust the interface name only if your NIC differs.

On the VPS as root, edit the PF configuration.

vim /etc/pf.conf

Use this content:

ext_if = "em0"
jail_net = "10.10.10.0/24"

set skip on lo
scrub in all

block all
pass out all keep state
pass in on $ext_if proto tcp to ( $ext_if ) port { 22, 80, 443 } keep state
pass in on lo1 from $jail_net to any keep state
pass out on lo1 from any to $jail_net keep state

Save and exit. Then enable and load PF.

sysrc pf_enable=YES
pfctl -nf /etc/pf.conf
service pf start

The pfctl -nf command checks syntax without activating changes. If it prints nothing, the file is valid. If it reports an error, fix the config before starting the firewall.

Prepare the jail framework

FreeBSD jails need a host directory tree and a clear networking plan. This tutorial uses a simple VNET-style layout with one jail per customer.

Create the base directories.

mkdir -p /usr/jails/template
mkdir -p /usr/jails/agency1
mkdir -p /usr/jails/agency2

Now tell FreeBSD to manage jails at boot and define the jail IP addresses.

sysrc jail_enable=YES
sysrc jail_list="agency1 agency2"
sysrc cloned_interfaces="lo1"
sysrc ifconfig_lo1="inet 10.10.10.1/24"
service netif restart lo1

The host will bind lo1 to the jail network. Each jail gets its own address on that subnet.

Create the jail configuration file.

vim /etc/jail.conf

Use this complete example:

path = "/usr/jails/$name";
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.consolelog = "/var/log/jail_$name.log";
mount.devfs;
allow.raw_sockets = 0;

agency1 {
  host.hostname = "agency1.server.example.com";
  ip4.addr = 10.10.10.11;
}

agency2 {
  host.hostname = "agency2.server.example.com";
  ip4.addr = 10.10.10.12;
}

Save and exit, then validate that the file parses as expected by starting one jail and checking its status.

service jail start agency1
service jail status agency1

A running jail should show agency1 as active. If it fails, check the log file named in exec.consolelog.

Bootstrap the jail userland

Each jail needs a minimal FreeBSD userland before you can install services inside it. The safest simple approach is to use bsdinstall or a released base archive. On a production system, you normally keep the template updated and clone from it.

On the VPS as root, fetch a base system into the template directory.

fetch -o /tmp/base.txz https://download.freebsd.org/ftp/releases/amd64/14.2-RELEASE/base.txz
tar -xpf /tmp/base.txz -C /usr/jails/template
cp -a /usr/jails/template/. /usr/jails/agency1
cp -a /usr/jails/template/. /usr/jails/agency2

This provides the base files for both jails. In a real support workflow, you would usually refresh the template centrally and then recreate customer jails from it during a migration window.

Install the minimum packages inside each jail. First, enter the jail.

jexec agency1 /bin/sh

Inside the jail, bootstrap package management and install the needed software. Exit the jail when done, then repeat for the second one.

env ASSUME_ALWAYS_YES=YES pkg bootstrap
pkg install -y nginx php82 php82-fpm

After the install, exit.

exit

Repeat the same steps for agency2. This keeps the customer environments consistent, which matters during agency onboarding and support handoffs.

Assign one customer site per jail

Now give each customer its own simple web root and service definition. The point is not to build a CMS in this tutorial. It is to prove isolation.

On the VPS as root, create a test page inside the first jail.

jexec agency1 sh -c 'mkdir -p /usr/local/www/nginx; echo "Agency 1 OK" > /usr/local/www/nginx/index.html'
jexec agency2 sh -c 'mkdir -p /usr/local/www/nginx; echo "Agency 2 OK" > /usr/local/www/nginx/index.html'

Enable and start the web server inside each jail.

jexec agency1 sysrc nginx_enable=YES
jexec agency1 service nginx start
jexec agency2 sysrc nginx_enable=YES
jexec agency2 service nginx start

Check the status from the host.

jexec agency1 service nginx status
jexec agency2 service nginx status

Each jail should report nginx is running.

Lock down the host and reduce support risk

Reseller account isolation is not only about jails. It also depends on reducing easy breakouts and accidental cross-access. Keep the host lean and keep privileged actions documented.

Set a clear hostname on the host so logs and support tickets are easier to read.

sysrc hostname="server.example.com"
service hostname restart

Review the current listening ports and confirm that the host only exposes the services you expect.

sockstat -4 -6 -l

You should see SSH on the host and web services inside the jails. If another daemon is listening unexpectedly, stop it before going live.

To keep updates predictable, create a simple maintenance habit:

freebsd-update fetch install
pkg update
pkg upgrade -y

On a managed account, this is the routine Hostperl support team would schedule during a maintenance window for customer safety. For larger reseller fleets, a dedicated servers platform gives you more room for multiple isolated jails and heavier traffic.

Test isolation from both host and client side

Verification matters more than the setup itself. You want proof that one customer cannot see the other customer’s files or processes.

On the VPS as root, inspect the running jails and the filesystems they use.

jls
mount | grep /usr/jails

You should see both agency1 and agency2 listed. Each one should have its own path under /usr/jails.

From the host, try to read a file in the other jail’s web root. This should only work if you explicitly enter that jail, not from the host filesystem by accident.

cat /usr/jails/agency1/usr/local/www/nginx/index.html
cat /usr/jails/agency2/usr/local/www/nginx/index.html

That access is acceptable only to root on the host. The real test is whether the jails themselves are separated.

On your local computer, check both site responses if you have port forwarding or DNS pointing at the jail front end.

curl -i http://203.0.113.10

If you publish each jail behind a reverse proxy or distinct virtual host later, each should answer with the expected content. For now, the point is to confirm the host remains stable while multiple isolated customer services are running.

Rollback and recovery if a jail breaks

If a jail fails after a package upgrade or config change, do not guess. Stop the jail, inspect the log, restore the previous file, and start it again.

On the VPS as root, stop the affected jail.

service jail stop agency1

Check the jail log you configured earlier.

tail -n 50 /var/log/jail_agency1.log

If the problem is a bad config line, restore the last known good copy from your backup or from version control, then test syntax again before starting the jail.

cp /root/backups/jail.conf.good /etc/jail.conf
service jail start agency1

If PF rules are the issue, test them before reloading the firewall:

pfctl -nf /etc/pf.conf

Then reload only after syntax passes.

service pf reload

That sequence avoids lockouts and keeps customer downtime short.

Hostperl can help you build reseller and agency hosting on the right platform for the workload, including larger isolated deployments that need more than a small general-purpose VPS. If you want room for multiple customer environments, see Hostperl VPS and dedicated server hosting.

For migration planning and support workflows, our team is used to staged cutovers, clean rollback paths, and customer-facing launch windows that do not leave you guessing at 2 a.m.

Common problems and quick fixes

PF will not start. Run pfctl -nf /etc/pf.conf. If it prints an error, fix the listed line and test again before loading the firewall.

A jail will not boot. Run service jail status agency1 and read /var/log/jail_agency1.log. Missing files under /usr/jails/agency1 or a bad IP assignment are the usual causes.

SSH key login fails for deploy. Run ls -ld /home/deploy /home/deploy/.ssh /home/deploy/.ssh/authorized_keys. Permissions that are too open are the common reason.

Web content is not reachable. Run jexec agency1 service nginx status and jexec agency1 sockstat -4 -l. If Nginx is not listening, start it inside the jail and check its config.

Result

You now have a FreeBSD-based reseller isolation model with a non-root admin, PF firewall rules, separate jails for separate customers, and a rollback plan if a jail misbehaves. That is a safer starting point for agency hosting than piling every customer into one shared service tree.

If you are planning this for production customers, Hostperl can help you choose the right hosting class and migration path so the support load stays manageable as you add more accounts.

FAQ

Is FreeBSD a good fit for reseller isolation?
Yes, if you want strong service separation and are comfortable managing jails, PF, and FreeBSD updates.

Can I run every customer in one jail?
You can, but it weakens isolation. Separate jails give you cleaner support boundaries and easier incident containment.

Do I need ZFS for this setup?
No, but ZFS snapshots can make rollback easier. If you already use ZFS on FreeBSD, snapshot each jail before major changes.

What should I verify after every change?
Check jail status, firewall syntax, listening ports, and one real service response. Those four checks catch most production mistakes.