小编Joh*_*Dow的帖子

sed:无法读取:没有这样的文件或目录

在临时文件夹中解压缩存档后,我将其用作文件夹中每个文件的 str_replace

find "$tmp" -type f | xargs sed -i "s/${targetsubstring}/${newsubstring}/g"
Run Code Online (Sandbox Code Playgroud)

但我收到此错误:

sed: can't read /tmp/tmp.Q18p8BRYcc/steam: No such file or directory
sed: can't read engine.txt: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我的 tmp 变量:

tmp=mktemp -d

我究竟做错了什么?

更新

archive=`readlink -e $1` #First param is tar archive without file structure (only text files inside)
targetsubstring=$2 #Substring to replace
newsubstring=$3 #Substring to replaced by
tmp=`mktemp -d` #Create a room to unzip our archive

if [ -f "$archive" ]; #Check if archive exist …
Run Code Online (Sandbox Code Playgroud)

linux sed

8
推荐指数
1
解决办法
5万
查看次数

使用 Wireguard 从本质上为本地网络中的计算机提供来自 VPS 的公共地址

我正在做家庭项目,并且想为我的机器提供分配给我在云中的 VPS 的公共 IP 地址。

在家里,我有一个公共 IP 地址,并且已经设置了 Wireguard 服务器,外部端口 1194 被转发到该计算机,因此来自互联网的 WG 客户端可以连接到它。

现在,我在云中有一个带有静态公共IP地址的VPS(假设有一个IP 44.44.44.44),而且我在本地网络中有一台机器(假设有一个IP 192.168.1.3),我希望本地网络中的机器将流量处理为它实际上拥有44.44.44.44云中 VPS 的公共 IP( )。这意味着到达 VPS 的所有传入流量都将路由到192.168.1.3本地网络中的计算机 ( )。

我使用 Wireguard 连接 WG 服务器和 VPS 没有任何问题,甚至通过 WG 服务器重定向来自 VPS 的所有流量(使用 iptables NAT 规则),但我陷入了路由来自 VPS 的传入流量保留原始流量的部分本地网络中机器的 IP 地址。

我的客户端(VPS)WG配置:

[Interface]
PrivateKey = dGhpcyBpcyBub3QgdGhlIGtleSA7KQ==
Address = 10.66.66.2/24
#This was part of the test usin
#PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 …
Run Code Online (Sandbox Code Playgroud)

networking vpn routing iptables wireguard

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

iptables ×1

linux ×1

networking ×1

routing ×1

sed ×1

vpn ×1

wireguard ×1