Setting Jail Name

Status
Not open for further replies.

Diekatzchen

Dabbler
Joined
Apr 10, 2012
Messages
45
Now that I have multiple jails, I can no longer get away with cronning "jexec 1" since the jid is randomly determined. No problem, says I, I can use the jail name instead. Except the "Jail Name" in Freenas sets the host name, not the jail name, so the jail name is set to the jid. And freenas takes jail management out of the hands of FreeBSD so I don't have a clue how to set it.

Is it even possible to set it?
 
J

jkh

Guest
I think you've found a bug (I would expect jail name to set, well, the jail name - it can set the hostname TOO but one would expect the jail name to follow suit). Can you file a bug report? Thanks!
 

Diekatzchen

Dabbler
Joined
Apr 10, 2012
Messages
45
I wouldn't call it a bug necessarily, since in the wiki it flat out says that it sets the hostname, it's just not a particularly useful behavior. I guess I'll put in a bug report for now.
 

titan_rw

Guru
Joined
Sep 1, 2012
Messages
586
Seems to work for me:

Code:
root@nas ~ # jls
  JID  IP Address      Hostname                      Path
    10  -              portjail                      /mnt/nas1pool/jails/portjail


My jail id could be gotten by grep'ing for 'portjail', which is what I called it in the GUI. It sets the 'hostname' of the jail to be whatever you called the jail in the gui. Isn't this expected behaviour? The hostname of freenas is 'nas'. (yea, creative, I know).

Something like:
Code:
jls | awk '/portjail/ {print $1}'


You could probably use variables to make something that looks better, but something like this works:

Code:
root@nas ~ # /usr/sbin/jexec `jls | awk '/portjail/ {print $1}'` /usr/local/bin/bash
root@portjail / # exit
root@nas ~ #


To get a bash shell in jail named "portjail".
 
Status
Not open for further replies.
Top