我已经使用该iptables-save >
命令保存了我的 iptables 规则,并且我正在尝试在机器启动时恢复这些规则。我已经在中添加了命令iptables-restore < "path to rules file"
,rc.local
但它没有启动规则。
我尝试直接在终端中运行该命令并且它起作用了,所以我知道该命令没有任何问题。我rc.local
也使用命令使文件可执行
sudo chmod +x /etc/rc.local
。
可能是什么问题?
编辑 - 正在使用 Fedora 22
为了在将精简配置快照应用于生产系统以进行备份之前对其进行测试,我执行了以下操作:
lvcreate -L1G -T storage/thinpool
lvcreate -V10M -T storage/thinpool -n thinvol1
lvcreate -V10M -T storage/thinpool -n thinvol2
# [create ext4 fs on thinvol1, mount it, add some files]
lvcreate -s --name snap1 storage/thinvol1
Run Code Online (Sandbox Code Playgroud)
所有命令都成功了,但是当lvdisplay storage/snap1
作为状态给出NOT available
并且\dev\storage\snap1
不是由设备映射器创建时:
--- Logical volume ---
LV Path /dev/storage/snap1
LV Name snap1
VG Name storage
LV UUID csDP34-HlpY-Rd8x-yJgr-99PW-jHZu-T7wsUJ
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2015-11-24 10:01:43 +0100
LV Pool name thinpool
LV Thin origin name thinvol1
LV …
我正在尝试将 iptables 规则文件保存到 /etc/sysconfig/iptables。我想在不登录 root 的情况下执行此操作。我尝试使用
须藤 iptables-save > /etc/sysconfig/iptables
但它抛出权限被拒绝错误。
如何在不登录 root 的情况下保存文件?我在我的应用程序中使用它,所以我不想通过应用程序登录到 root。
谢谢