freebsd jail命令执行无故报错
Freebsd jail command execution error with no reason
我尝试执行命令:
# service jail start myjail
我调试 /etc/rc.d/jail 并转储真正的命令是:
/usr/sbin/jail -l -U root -i -f /var/run/jail.myjail.conf -c myjail
输出为:
usage: jail [-dhilqv] [-J jid_file] [-u username] [-U username]
-[cmr] param=value ... [command=command ...]
jail [-dqv] [-f file] -[cmr] [jail]
jail [-qv] [-f file] -[rR] ['*' | jail ...]
jail [-dhilqv] [-J jid_file] [-u username] [-U username]
[-n jailname] [-s securelevel]
path hostname [ip[,...]] command ...
文件 /var/run/jail.myjail.conf 由 rc jail 脚本根据之前从 rc.conf
运行的 jail 的变量自动生成
内容为:
myjail {
host.hostname = "myjail.example.com";
path = "/var/jail/myjail.root";
ip4.addr += "192.168.0.150/32";
allow.raw_sockets = 0;
exec.clean;
exec.system_user = "root";
exec.jail_user = "root";
exec.start += "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.consolelog = "/var/log/jail_myjail_console.log";
mount.devfs;
allow.set_hostname = 0;
allow.sysvipc = 0;
}
怎么了?
通过一行替换 rc.conf
中的旧样式配置变量解决的问题:
jail_myjail_conf="/var/run/jail.myjail.conf"
我尝试执行命令:
# service jail start myjail
我调试 /etc/rc.d/jail 并转储真正的命令是:
/usr/sbin/jail -l -U root -i -f /var/run/jail.myjail.conf -c myjail
输出为:
usage: jail [-dhilqv] [-J jid_file] [-u username] [-U username] -[cmr] param=value ... [command=command ...] jail [-dqv] [-f file] -[cmr] [jail] jail [-qv] [-f file] -[rR] ['*' | jail ...] jail [-dhilqv] [-J jid_file] [-u username] [-U username] [-n jailname] [-s securelevel] path hostname [ip[,...]] command ...
文件 /var/run/jail.myjail.conf 由 rc jail 脚本根据之前从 rc.conf
运行的 jail 的变量自动生成内容为:
myjail {
host.hostname = "myjail.example.com";
path = "/var/jail/myjail.root";
ip4.addr += "192.168.0.150/32";
allow.raw_sockets = 0;
exec.clean;
exec.system_user = "root";
exec.jail_user = "root";
exec.start += "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.consolelog = "/var/log/jail_myjail_console.log";
mount.devfs;
allow.set_hostname = 0;
allow.sysvipc = 0;
}
怎么了?
通过一行替换 rc.conf
中的旧样式配置变量解决的问题:
jail_myjail_conf="/var/run/jail.myjail.conf"