/etc/jail.conf documentation?

Mark Felder feld at FreeBSD.org
Thu Oct 29 13:48:41 UTC 2015



On Thu, Oct 29, 2015, at 07:17, krad wrote:
> here is an extract from one of my jail configs which shows a few other
> things to play with. Remember vnet and pf dont play at present.
> 
> 
>      # Typical static defaults:
>      # Use the rc scripts to start and stop jails.  Mount jail's /dev.
>      exec.start = "/bin/sh /etc/rc";
>      exec.stop = "/bin/sh /etc/rc.shutdown";
>      exec.clean;
>      mount.devfs;
> 
> 
>      # Dynamic wildcard parameter:
>      # Base the path off the jail name.
>      path = "/jails/$name";
> 
> 
>      emby {
>              host.hostname = "emby.intranet";
>              vnet.interface = emby_a;
>              vnet;
>              exec.prestart  = "ifconfig emby_a destroy || true ";
>              exec.prestart  += "ifconfig emby_b destroy || true";
>              exec.prestart  += "ifconfig epair8 create up";
>              exec.prestart  += "ifconfig epair8a name emby_a";
>              exec.prestart  += "ifconfig epair8b name emby_b";
>              exec.prestart  += "ifconfig emby_b up";
>              exec.prestart  += "ifconfig bridge0 addm emby_b";
>              exec.prestart  += "ifconfig emby_a ether 02:ff:25:fc:05:da";
>              exec.prestart  += " df | grep -q  /jails/emby/videos || 
>              mount
> -t nullfs -o rw /videos /jails/emby/videos/";
>              exec.poststop  = "ifconfig emby_a destroy";
>              exec.poststop  += "ifconfig emby_b destroy";
>              exec.poststop += "/sbin/umount /jails/emby/videos || true ";
>              exec.start += "/sbin/dhclient emby_a";
>              exec.start += "ifconfig emby_a inet6 accept_rtadv";
>              exec.start += "/etc/rc.d/rtsold start";
>         }
> 

You don't need to handle mounting filesystems this way. Just define

      mount.fstab = /etc/fstab.$name;

and then create /etc/fstab.emby

Put your fstab entries in that file and it will do the right thing for
you automatically.


-- 
  Mark Felder
  ports-secteam member
  feld at FreeBSD.org


More information about the freebsd-questions mailing list