iptables -L —>用法:/etc/init.d/iptables {start | stop | restart | condrestart | status | panic | save}

我正在运行CentOS 5.当我键入

iptables -L

我明白了

用法:iptables {start | stop | restart | condrestart | status | panic | save}

它出什么问题了?

你能告诉我们你的$PATHwhich iptables的输出? 乍一看,它在我看来,如果你拿起/etc/init.d/iptables优先于/sbin/iptables

如果是的话,修正是找出/etc/init.d是如何进入PATH的,并将其删除。 把它放在那里看起来很有吸引力,但是挑选错误的东西(例如,sendmail,你可能会拿起服务启动脚本而不是实际的MTA二进制文件,以及像sendmail -q -v这样的命令sendmail -q -v也会出错)。

尝试这个:

 From your user account: su - iptables -L 

与其他发行版一样,Cent并不像其他发行版那样将/ sbin /添加到用户帐户的path中,所以我打赌你以自己的身份login,通过某种方式获得了根访问权限,没有正确更新你的环境(或者试图添加更奇怪的东西你的path来解决发布之前的问题),现在你运行iptables的init脚本。 上面的代码可以让你获得root环境的访问权限。