Skip to main content

Bash: Returns error without sudo [Resolved]

I'm running Kali Linux Live, and I was using the system as the root user for a long time before I came across an article online telling you NOT to use root as your default account, and that instead you should create a low-privileged user. I ended up doing just that, and everything was OK, until I tried to run ifconfig, to which I received the error: bash: ifconfig: command not found.

I tried running sudo apt-get install ifconfig, but it returned that ifconfig was already the newest version. I was a little confused, so I tried sudo ifconfig, since I had to use sudo to run apt-get. Sure enough, sudo ifconfig worked, and any other commands I need to run that return a similar error work with sudo.

So my problem is that the programs I need to run are stored (I presume) in the root system when I install them with sudo apt-get install, and are therefore unaccessible by non-root users? I'm not sure if that's correct or not. Reading the manual for sudo, I know it runs a command as root (or another user in general), but does that mean the "output is executed" in the root's system? If so, what can I do to run commands as a low-privileged user, besides giving them admin privileges?

Thanks for any and all support!


Question Credit: Anonymous
Question Reference
Asked July 20, 2019
Posted Under: Unix Linux
8 views
2 Answers

They are in /sbin and /usr/sbin anyone can run them. However it may or may not be useful to do so. If you don't have the capabilities than most of these commands will not do much. User root traditionally has all capabilities. And /sbin and /usr/sbin are not normally in a normal users execute search PATH.

ifconfig is useful as a normal user, but you won't get all features. e.g. /sbin/ifconfig with no arguments, will list all network interfaces.


credit: ctrl-alt-delor
Answered July 20, 2019
Your Answer
D:\Adnan\Candoerz\CandoProject\vQA