Certain programs not found unless root
I seem to have a problem with certain programs not being found unless I su into root. A couple of examples are iwconfig and pkgtool. Using sudo doesn't work. How can this be fixed?
|
can you show the output of:
Code:
echo $PATH |
bash-4.1$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/java/bin:/usr/lib/kde4/libexec:/usr/lib/qt/bin:. bash-4.1$ which iwconfig which: no iwconfig in (/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/java/bin:/usr/lib/kde4/libexec:/usr/lib/qt/bin:.) bash-4.1$ su Password: bash-4.1# echo $PATH /usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin bash-4.1# which iwconfig /sbin/iwconfig bash-4.1# Looks like the paths are not set right for my regular account. Never had to fix paths in Linux before, so I don't know how to do it. Normally this would be set correctly. |
add /sbin to the users path; still mite need to sudo.
|
This is because /sbin and /usr/sbin are included in root's PATH only. Either continue using 'su -' to become root (that's what I do) or add those directories to PATH for your user.
|
Code:
[schneidz@hyper abg]$ cat ~/.bash_profile |
These programs are supposed to be used only by root. And in Slackware, but in some very special cases, sudo's usage is not needed, so "su" or "su -" is the way to go.
|
I assume that .bashrc and .bash_profile are supposed to be in the home folder of each account on the system. I just checked both root's and my regular user's home folder's and these files appear to be missing. The only file that I do see is .bash_history in both home folders. How is the path being set if these files are missing?
I would rather use sudo over su to limit how much root is used. |
This behaviour is fairly normal, and even intended. Take a peek in /sbin, you will see a bunch of system administration tools, like fdisk for example. In real life, this would be the equivalent of a chainsaw. Your kids/users have no business with it.
|
I prefer to not include /sbin and /usr/sbin in my users' PATH. Having to provide the full path to the executable when using 'sudo' provides a small sanity check and prevents me from getting to comfortable with executing privileged commands.
|
I found out that /etc/profile is where the path is being set. I changed the paths and everything is working with sudo now.
I prefer to execute certain commands with sudo on an as needed basis and not have to provide the full path or use su. I'm also the only one who uses this system so this setup makes sense. Even if others used this system or I had kids (which I don't) they'd still need the root password which I would not give out to use certain commands. |
sudo /sbin/pkgtool seems easy enough to me.
|
All times are GMT -5. The time now is 02:26 AM. |