Is there a way to know my JID?

Thanx SirDice.

Now another question: can I force my jails to use always the same JID (even when I restart them)? I remember trying to use the jid parameter -as the man page suggests- but for some reason, that I don't remember right now, I failed. I know that this doesn't help much :) but if someone knows what the correct syntax would be for /etc/rc.conf, I'd be really happy!

Thanx again.
 
Don't rely on the JID, set a proper name for the jail. That's much easier to use.
 
SirDice said:
Don't rely on the JID, set a proper name for the jail. That's much easier to use.

According to jexec(8) you can use the jid or the name to execute commands. But this does not work for me if I use the name. No problem when I use the jid. I´m using ezjail to create/manage my jails.
Code:
# jls
JID  IP Address      Hostname                      Path
1  10.0.0.82       webtest.foobar.dom            /usr/jails/webtest

# jexec webtest tcsh
jexec: jail "webtest" not found
I have no jail_* parameters in /etc/rc.conf. Just 'ezjail_enable"YES"'.
What am I doing wrong?
 
The jail "name" doesn't necessarily refer to the jail's hostname.

Code:
     -n jailname
             Set the jail's name.  This is deprecated and is equivalent to
             setting the name parameter.

Code:
     name    The jail name.  This is an arbitrary string that identifies a
             jail (except it may not contain a `.').  Like the jid, it can be
             passed to later jail commands, or to jls(8) or jexec(8).  If no
             name is supplied, a default is assumed that is the same as the
             jid.

From jail(8).
 
SirDice,

I'm trying the config that you're suggesting and this is an excerpt from my /etc/rc.conf:

Code:
jail_list="sambatest"
jail_sambatest_hostname="samba-test.lala"
jail_sambatest_rootdir="/jails/j/samba.test"
jail_sambatest_devfs_enable="YES"
jail_sambatest_ip="192.168.12.12"
jail_sambatest_interface="lo2"
jail_sambatest_name="sambat"

when I run:

Code:
[root@filesrv ~]# jls
19  192.168.12.12   samba-test.lsls         /jails/j/samba.test
[root@filesrv ~]# jexec sambat bash
jexec: jail "sambat" not found
[root@filesrv ~]#

And now I remember that this was what I was forgetting in my previous post! I tried the name parameter with no luck (same configuration as the one above) and didn't move on.
 
I haven't had much luck with jail_*_name either. I solved that by adding flags.

Code:
jail_myjail_flags="-l -U root -n myjail"

(The "-l -U root" are the default flags)
 
Great SirDice!

That worked for me too! Should we send a bug report for it or is it stated somewhere in the documentation that not all parameters are implemented with the jail_*_parametername format?
 
I'm not sure, I just now read that the -n option is actually deprecated. But I can't find any other option to use for it. Or the sentence is a bit wonky and you should use the "name" parameter instead.
 
Back
Top