LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Certain programs not found unless root (https://www.linuxquestions.org/questions/slackware-14/certain-programs-not-found-unless-root-4175423933/)

Arcosanti 08-25-2012 07:14 AM

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?

schneidz 08-25-2012 07:21 AM

can you show the output of:
Code:

echo $PATH
which iwconfig

as both users.

Arcosanti 08-25-2012 07:29 AM

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.

schneidz 08-25-2012 07:32 AM

add /sbin to the users path; still mite need to sudo.

audriusk 08-25-2012 07:32 AM

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.

schneidz 08-25-2012 07:40 AM

Code:

[schneidz@hyper abg]$ cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH


#/home/schneidz/nfs-w/leaderboard.ksh &

echo \~ \"\" \$ \^ \&\& \( \) \{ \} \>\> \@ \: \| \_ >> /home/schneidz/.bash_history

alias grep='grep --color=auto'

nautilus &


Didier Spaier 08-25-2012 07:57 AM

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.

Arcosanti 08-25-2012 07:59 AM

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.

kikinovak 08-25-2012 07:59 AM

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.

saulgoode 08-25-2012 08:15 AM

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.

Arcosanti 08-25-2012 09:06 AM

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.

psionl0 08-25-2012 11:04 AM

sudo /sbin/pkgtool seems easy enough to me.


All times are GMT -5. The time now is 02:26 AM.