我希望我的 iptables 规则在启动时自动加载。根据 Debian 上的 wiki,这可以通过在 /etc/network/if-pre-up.d/ 中放置一个名为 iptables 的脚本来完成,所以我做到了,这就是它的样子:
cat /etc/network/if-pre-up.d/iptables
#!/bin/sh
/sbin/iptables-restore < /etc/firewall/iptables.rules
/sbin/ip6tables-restore < /etc/firewall/ip6tables.rules
Run Code Online (Sandbox Code Playgroud)
这个脚本有效:如果我以 root 身份运行它,我的防火墙规则就会被应用。但是在重新启动时没有防火墙规则。我究竟做错了什么?
根据要求:/etc/network/interfaces(我没有碰过这个文件)
user@DebianVPS:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
Run Code Online (Sandbox Code Playgroud) 我们有以下情况:
我对 #2 和 #3 都没有 root 权限。我也不能在机器 #2 上真正存储信息(不超过 200 MiB)(因为它是进入网络其余部分的网关,不能更多)。在 #3 机器上,有一个文件夹,大小约为 3 GiB,我想将其复制到本地。我不能从#1 SSH 到#3,但我可以SSH 到#2,然后到#3。也无法在#2 和#3 之间设置公钥对,但在#1 和#2 之间安装了一个密钥对。
通常我使用 SSH 和 tar 的组合来完成这项工作:
ssh name@host "tar cf - folder" > folder.tar
Run Code Online (Sandbox Code Playgroud)
但是在这种情况下,这将需要某种嵌套,而我似乎无法完成此操作。
那么,将数据从#3 获取到#1 的好方法是什么?
我正在运行 Debian 7 stable 和无人值守升级(每天早上 6 点),以确保我总是完全更新。我有以下配置:
$ cat /etc/apt/apt.conf.d/50unattended-upgrades
// Automatically upgrade packages from these origin patterns
Unattended-Upgrade::Origins-Pattern {
// Archive or Suite based matching:
// Note that this will silently match a different release after
// migration to the specified archive (e.g. testing becomes the
// new stable).
"o=Debian,a=stable";
"o=Debian,a=stable-updates";
// "o=Debian,a=proposed-updates";
"origin=Debian,archive=stable,label=Debian-Security";
};
// List of packages to not update
Unattended-Upgrade::Package-Blacklist {
// "vim";
// "libc6";
// "libc6-dev";
// "libc6-i686";
};
// This option allows you to …Run Code Online (Sandbox Code Playgroud)