Docfuntional

Documentation by Dysphunkional

Jails

A jail is FreeBSD way of putting a portion of a system behind restrictions so that the jailed software can’t access the rest of the system. This is sort of like having a virtual machine running the same OS as the host but with almost no performance overhead. Jails are also how plugins are implemented on a FreeNAS server. Jails are similar to Linux Containers (LXC) and Solaris Zones.

“Jails are like chroot on steroids.”

Here are some general tips for working with a jail. Most of them will also apply to BSD in general too.

Logging into a Jail


To log into a jail you first need to get to the command prompt of the host system. You can do that by connecting to the server using a ssh client like PuTTy or by selecting Shell in the FreeNAS WebUI.
Frist you need to find out the ID of the jail by running the jls command

jls

You should see a table like this:

   JID  IP Address      Hostname                      Path
     1  10.1.0.12       Testing                       /mnt/vol0/jails/Testing
     2  10.1.0.13       Production                    /mnt/vol0/jails/Production

Now run

jexec ID command

where ID is the JID from the output of the jls command and command is the name of the shell you want to use in the jail. tcsh is installed by default so you can use that until you install another shell. I prefer bash. So if I wanted to log into my Testing jail using tcsh I would use the command:

jexec 1 tcsh

If I wanted to log into my Production jail using bash I would use the command:

jexec 2 bash

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: