numeric jail name in jail.conf

Jamie Gritton jamie at FreeBSD.org
Sat Mar 23 05:43:20 UTC 2013


On 03/22/13 05:25, Nicolas de Bari Embriz Garcia Rojas wrote:
> Hi, when using a numeric names for a jails something like:
>
> 10 {
>      exec.start = "/bin/sh /etc/rc";
>      exec.stop = "/bin/sh /etc/rc.shutdown";
>      ....
> }
>
> 20 {
>      exec.start = "/bin/sh /etc/rc";
>      exec.stop = "/bin/sh /etc/rc.shutdown";
>      ....
> }
>
> the name (numeric) becomes the jail ID when, therefore when I type a jls
> command i see the  10,and 20 as the jails ID's,
>
> My question is, is this the proper way to explicitly set the id when
> using jail.conf ?
>
> For me, this as been working fine and I can match the jail ids to use
> rctl on every reboot, but just want to be sure if this is the correct
> way of doing it.
>
> thanks in advance.

That's a fine and proper way to do it. You can also set it in the body
of the jail definition with e.g. "jid = 10". For that matter, these two
definitions are nearly equivalent:

10 {
     name = "foo";
     ...
}

foo {
     jid = 10;
     ...
}

I say "nearly" because while they'll create the same jail, you would use
10 or foo respectively on the command line if you were operating on one
of them. For example, if you wanted to start only one jail in a conf
file, "jail -c foo" would work only for the second definition.

- Jamie


More information about the freebsd-jail mailing list