Freebsd jail命令执行错误没有任何理由

时间:2017-05-20 10:52:19

标签: freebsd jail

我尝试执行命令:

# 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;
}

有什么问题?

1 个答案:

答案 0 :(得分:0)

通过将rc.conf中的旧样式配置变量替换为一行来解决问题:

jail_myjail_conf="/var/run/jail.myjail.conf"