1.1 问题描述
安装net-tools之后,依然无法通过root用户直接使用ifconfig命令
sudo ifconfig即可以正常使用:
1.2 排查问题
1.2.1 查看是否安装成功net-tools
whereis ifconfig
发现ifconfig在/usr/sbin路径下,其为root命令目录,需要sudo才能调用sbin路径下的命令。
1.2.2 绝对路径确认是否可以运行ifconfig
发现绝对路径下可以使用。
1.3 处理方法
1.3.1 将/usr/sbin路径添加到环境变量PATH
echo $PATH
PATH=$PATH:/usr/sbin
1.3.2 确认直接ifconfig是否可以使用
Compelete!