SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.