use*_*678 4 linux unix ifconfig
为了ifconfig在Linux中更改IP和VIP是否需要root权限?
或者也可以通过非 root 帐户执行此操作?
Cel*_*ada 10
您不需要 root 访问权限ifconfig来更改 IP 地址,只需要CAP_NET_ADMIN。让我们创建一个ifconfigwith CAP_NET_ADMINenabled的副本来查看:
cp /sbin/ifconfig .
sudo setcap cap_net_admin=eip ./ifconfig
./ifconfig eth0 1.2.3.4 # succeeds
# Wouldn't want to leave this copy of ifconfig around,
# It's a security hole!
rm ifconfig
Run Code Online (Sandbox Code Playgroud)