免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 5770 | 回复: 21
打印 上一主题 下一主题

为什么脚本执行报错? [复制链接]

论坛徽章:
1
摩羯座
日期:2014-12-22 14:37:25
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-15 09:52 |只看该作者 |倒序浏览
  1. #!/bin/bash
  2. export PATH=/sbin:/usr/sbin:/bin:/usr/bin;
  3. modprobe ip_tables
  4. modprobe ip_conntrack
  5. modprobe iptable_nat
  6. modprobe ip_nat_ftp
  7. modprobe ip_conntrack_ftp

  8. IPT="/sbin/iptables"

  9. $IPT -F
  10. $IPT -X
  11. $IPT -F -t nat
  12. $IPT -X -t nat


  13. $IPT -A INPUT -p tcp --dport 22 -j ACCEPT
  14. $IPT -P INPUT DROP
  15. $IPT -P OUTPUT ACCEPT
  16. $IPT -P FORWARD ACCEPT
  17. $IPT -A INPUT -p tcp --dport 80 -j ACCEPT
  18. $IPT -A INPUT -p tcp --dport 90 -j ACCEPT
  19. $IPT -A INPUT -i lo -j ACCEPT
复制代码
执行报错如下:
: command not found
not found.le ip_tables
not found.le ip_conntrack
not found.le iptable_nat
not found.le ip_nat_ftp
not found.le ip_conntrack_ftp
: command not found
: command not found
: 没有那个文件或目录sbin/iptables
: 没有那个文件或目录sbin/iptables
: 没有那个文件或目录sbin/iptables
: 没有那个文件或目录sbin/iptables
: command not found
: command not found
: 没有那个文件或目录sbin/iptables
: 没有那个文件或目录sbin/iptables
: 没有那个文件或目录sbin/iptables
: 没有那个文件或目录sbin/iptables
: 没有那个文件或目录sbin/iptables
: 没有那个文件或目录sbin/iptables
: 没有那个文件或目录sbin/iptables

我给这个脚本755权限了,为什么会这样?

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
2 [报告]
发表于 2011-12-15 09:54 |只看该作者
export PATH=/sbin:/usr/sbin:/bin:/usr/bin;
最后面的那个;不要

论坛徽章:
1
摩羯座
日期:2014-12-22 14:37:25
3 [报告]
发表于 2011-12-15 10:06 |只看该作者
回复 2# chenyx


    改了,除了那一行没有错误提示了,下面的继续是错误

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
4 [报告]
发表于 2011-12-15 10:37 |只看该作者
错误提示写出来

论坛徽章:
1
摩羯座
日期:2014-12-22 14:37:25
5 [报告]
发表于 2011-12-15 11:22 |只看该作者
回复 4# chenyx
  1. [root@localhost ~]# sh firew.sh
  2. not found.le ip_tables
  3. not found.le ip_conntrack
  4. not found.le iptable_nat
  5. not found.le ip_nat_ftp
  6. not found.le ip_conntrack_ftp
  7. : command not found
  8. : command not found
  9. : 没有那个文件或目录sbin/iptables
  10. : 没有那个文件或目录sbin/iptables
  11. : 没有那个文件或目录sbin/iptables
  12. : 没有那个文件或目录sbin/iptables
  13. : command not found
  14. : command not found
  15. : 没有那个文件或目录sbin/iptables
  16. : 没有那个文件或目录sbin/iptables
  17. : 没有那个文件或目录sbin/iptables
  18. : 没有那个文件或目录sbin/iptables
  19. : 没有那个文件或目录sbin/iptables
  20. : 没有那个文件或目录sbin/iptables
  21. : 没有那个文件或目录sbin/iptables
复制代码

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
6 [报告]
发表于 2011-12-15 11:26 |只看该作者
你的脚本我运行了,删除;之后,没有报错,应该是你系统的问题,你仔细检查下那几个iptables的module是否存在吧

论坛徽章:
34
亥猪
日期:2015-03-20 13:55:11戌狗
日期:2015-03-20 13:57:01酉鸡
日期:2015-03-20 14:03:56未羊
日期:2015-03-20 14:18:30子鼠
日期:2015-03-20 14:20:14丑牛
日期:2015-03-20 14:20:31辰龙
日期:2015-03-20 14:35:34巳蛇
日期:2015-03-20 14:35:56操作系统版块每日发帖之星
日期:2015-11-06 06:20:00操作系统版块每日发帖之星
日期:2015-11-08 06:20:00操作系统版块每日发帖之星
日期:2015-11-19 06:20:00黄金圣斗士
日期:2015-11-24 10:43:13
7 [报告]
发表于 2011-12-15 15:27 |只看该作者
手动 modprobe 看看有报错么

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
8 [报告]
发表于 2011-12-15 21:08 |只看该作者
很显然,系统安装不完整嘛。

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
9 [报告]
发表于 2011-12-15 21:13 |只看该作者
该有的文件没有撒。

论坛徽章:
0
10 [报告]
发表于 2011-12-15 21:18 |只看该作者
不要用sh firew.sh, 试试下面的

  1. bash firew.sh
复制代码

  1. chmod +x firew.sh
  2. ./firew.sh
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP