/etc/rc.d/init.d/iptables: No such file or directory 错误原因

注:本文转载自cnblogs:一天学点的文章《/etc/rc.d/init.d/iptables: No such file or directory 错误原因》

RedHat Enterprise Linux 7关闭防火墙方法

在之前的版本中关闭防火墙等服务的命令是

  1 service iptables stop
  2 
  3 /etc/init.d/iptables stop

在RHEL7中,其实没有这个服务

  1 [root@rhel7 ~]# cat /etc/redhat-release
  2 Red Hat Enterprise Linux Server release 7.0 (Maipo)
  3 [root@rhel7 ~]# service iptables stop
  4 Redirecting to /bin/systemctl stop  iptables.service
  5 [root@rhel7 ~]# /etc/init.d/iptables stop
  6 -bash: /etc/init.d/iptables: No such file or directory

原来在RHEL7开始,使用systemctl工具来管理服务程序,包括了service和chkconfig

  1 [root@rhel7 ~]# systemctl list-unit-files|grep enabled
  2 cups.path                                   enabled
  3 abrt-ccpp.service                           enabled
  4 abrt-oops.service                           enabled
  5 abrt-vmcore.service                         enabled
  6 abrt-xorg.service                           enabled
  7 abrtd.service                               enabled
  8 accounts-daemon.service                     enabled
  9 atd.service                                 enabled
 10 auditd.service                              enabled
 11 avahi-daemon.service                        enabled
 12 bluetooth.service                           enabled
 13 chronyd.service                             enabled
 14 crond.service                               enabled
 15 cups.service                                enabled
 16 dbus-org.bluez.service                      enabled
 17 dbus-org.fedoraproject.FirewallD1.service   enabled
 18 dbus-org.freedesktop.Avahi.service          enabled
 19 dbus-org.freedesktop.ModemManager1.service  enabled
 20 dbus-org.freedesktop.NetworkManager.service enabled
 21 dbus-org.freedesktop.nm-dispatcher.service  enabled
 22 display-manager.service                     enabled
 23 dmraid-activation.service                   enabled
 24 firewalld.service                           enabled
 25 firstboot-graphical.service                 enabled
 26 gdm.service                                 enabled
 27 getty@.service                              enabled
 28 hypervkvpd.service                          enabled
 29 hypervvssd.service                          enabled
 30 irqbalance.service                          enabled
 31 iscsi.service                               enabled
 32 ksm.service                                 enabled
 33 ksmtuned.service                            enabled
 34 libstoragemgmt.service                      enabled
 35 libvirtd.service                            enabled
 36 lvm2-monitor.service                        enabled
 37 mdmonitor.service                           enabled
 38 microcode.service                           enabled
 39 ModemManager.service                        enabled
 40 multipathd.service                          enabled
 41 NetworkManager-dispatcher.service           enabled
 42 NetworkManager.service                      enabled
 43 nfs-lock.service                            enabled
 44 packagekit-offline-update.service           enabled
 45 postfix.service                             enabled
 46 rhsmcertd.service                           enabled
 47 rngd.service                                enabled
 48 rpcbind.service                             enabled
 49 rsyslog.service                             enabled
 50 rtkit-daemon.service                        enabled
 51 smartd.service                              enabled
 52 spice-vdagentd.service                      enabled
 53 sshd.service                                enabled
 54 sysstat.service                             enabled
 55 systemd-readahead-collect.service           enabled
 56 systemd-readahead-drop.service              enabled
 57 systemd-readahead-replay.service            enabled
 58 tuned.service                               enabled
 59 vmtoolsd.service                            enabled
 60 avahi-daemon.socket                         enabled
 61 cups.socket                                 enabled
 62 dm-event.socket                             enabled
 63 iscsid.socket                               enabled
 64 iscsiuio.socket                             enabled
 65 lvm2-lvmetad.socket                         enabled
 66 rpcbind.socket                              enabled
 67 default.target                              enabled
 68 graphical.target                            enabled
 69 nfs.target                                  enabled
 70 remote-fs.target                            enabled



禁用防火墙

  1 [root@rhel7 ~]# systemctl stop firewalld.service
  2 [root@rhel7 ~]# systemctl disable firewalld.service
  3 [root@rhel7 ~]# systemctl status firewalld.service
  4 firewalld.service – firewalld – dynamic firewall daemon
  5    Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
  6    Active: inactive (dead)
  7 
  8 Jul 29 22:25:43 rhel7 systemd[1]: Started firewalld – dynamic firewall daemon.
  9 Jul 29 22:43:29 rhel7 systemd[1]: Stopping firewalld – dynamic firewall daemon…
 10 Jul 29 22:43:29 rhel7 systemd[1]: Stopped firewalld – dynamic firewall daemon.
 11 Jul 29 22:44:14 rhel7 systemd[1]: Stopped firewalld – dynamic firewall daemon.
 12 Jul 29 22:44:15 rhel7 systemd[1]: Stopped firewalld – dynamic firewall daemon.
 13 Jul 29 22:44:19 rhel7 systemd[1]: Starting firewalld – dynamic firewall daemon…
 14 Jul 29 22:44:19 rhel7 systemd[1]: Started firewalld – dynamic firewall daemon.
 15 Jul 29 22:44:21 rhel7 systemd[1]: Stopping firewalld – dynamic firewall daemon…
 16 Jul 29 22:44:21 rhel7 systemd[1]: Stopped firewalld – dynamic firewall daemon.
 17 Jul 29 22:44:32 rhel7 systemd[1]: Stopped firewalld – dynamic firewall daemon.


  1 启动一个服务:systemctl start firewalld.service
  2 关闭一个服务:systemctl stop firewalld.service
  3 重启一个服务:systemctl restart firewalld.service
  4 显示一个服务的状态:systemctl status firewalld.service
  5 在开机时启用一个服务:systemctl enable firewalld.service
  6 在开机时禁用一个服务:systemctl disable firewalld.service
  7 查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?
  8 查看已启动的服务列表:systemctl list-unit-files|grep enabled



批注:对于这个文章的提示,我不知道是没有得到操作要领还是怎么回事,反正标题的问题我没有得到解决。

image

展开阅读全文

蛋疼的can't run '/etc/init.d/rcS': No such file or directory

03-21

内核启动出现这样的错误:can't run '/etc/init.d/rcS': No such file or directory;简单的启动信息如下:rnrtc-pcf8563 0-0051: low voltage detected, date/time is not reliable.rnrtc-pcf8563 0-0051: retrieved date/time is not valid.rnrtc-pcf8563 0-0051: hctosys: invalid date/timernRAMDISK: gzip image found at block 0rnVFS: Mounted root (ext2 filesystem) on device 1:0.rnFreeing init memory: 116Krn[color=#FF0000]can't run '/etc/init.d/rcS': No such file or directory[/color]rnrnProcessing /etc/profile... Set search library path in /etc/profilernSet user path in /etc/profilernSet PS1 in /etc/profilernDonernrn[root@/]#rn这个rcS的权限已经设置为777了,rcS文件也没有乱码,其内容如下:rnrn#! /bin/shrnecho "----------mount all"rn/bin/mount -arnrnrnecho "----------Starting mdev......"rn/bin/echo /sbin/mdev > /proc/sys/kernel/hotplugrnmdev -srnrnmount -t yaffs /dev/mtdblock6 /usrrnrnsyslogd -O /usr/PGS/log/messages -s 2 -l 7rnrnrn在同一个内核下,烧写以前的根文件系统却没有问题,能正常启动rcS,他的启动信息如下:rnrtc-pcf8563 0-0051: low voltage detected, date/time is not reliable.rnrtc-pcf8563 0-0051: retrieved date/time is not valid.rnrtc-pcf8563 0-0051: hctosys: invalid date/timernFailed to execute /linuxrc. Attempting defaults...rn----------mount allrn----------Starting mdev......rnyaffs: dev is 32505862 name is "mtdblock6"rnyaffs: passed flags ""rnyaffs: Attempting MTD mount on 31.6, "mtdblock6"rnyaffs: block 2000 is marked badrnblock 2001 is badrnyaffs_read_super: isCheckpointed 0rnrnProcessing /etc/profile... Set search library path in /etc/profilernSet user path in /etc/profilernSet PS1 in /etc/profilernDonern[root@/]#rnrnrnrn求高手指点迷津,这问题已经搞了1个星期了,毫无思绪~~~~rn 论坛

没有更多推荐了,返回首页