FreeBSD (ez)jail howto

Table of Contents

Prepare the system
Create ezjail templates
Working with the jails

Working with the jails

by ross at 14:06:22 on February 23, 2013

Create the jails

We have two aliases on external interface of host system:

  • jail1.example.com: 1.2.3.5
  • jail2.example.com: 1.2.3.6

Create the jails using webserver flavour:

# ezjail-admin create -f webserver jail1.example.com 1.2.3.5
# ezjail-admin create -f webserver jail2.example.com 1.2.3.6

Basic jail commands

Start all the jails:

# service ezjail start

You can add jail name to the command above to control particular jail:

# service ezjail restart jail1.example.com

List running jails:

# jls

Connect to a running jail:

ezjail-admin console jail1.example.com

Delete the jail and wipe its directory:

# service ezjail stop jail1.example.com
# ezjail-admin delete -w jail1.example.com

Updating the jails

In order to update jails base system (basejail):

# service ezjail stop
# ezjail-admin update -i
# service ezjail start

Run the commands above after you do installworld on the host system.

Updating jail ports is done with the following command (no need to stop jails):

# ezjail-admin update -P

 

Comments