Take the 2-minute tour ×

I'm new to Linux. I've just installed the STAF, and I can run STAF with my account, but when I try to run use root account, I get:

sudo: STAF: command not found

Here is some of my machine information:

which sudo


echo $PATH


What is the explanation? Why can't sudo find the command?

share|improve this question
What does "sudo env | grep PATH" output? –  Dylan May 17 '09 at 5:12
sudo env | grep PATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin –  eric2323223 May 17 '09 at 5:17

3 Answers 3

The proper PATH is obviously not set for the root user.

share|improve this answer

Your answer is on this (duplicate) question,


share|improve this answer
@Dylan, thanks for link. –  eric2323223 May 17 '09 at 5:21
Here's the post: This is an annoying function of sudo on ubuntu. Note this doesn't happen on fedora for example as sudo is not built with the --with-secure-path option there. To work around this "problem" on ubuntu I do the following in my "~/.bashrc": alias sudo='sudo env PATH=$PATH' ...note this will work for commands that don't reset the $PATH themselves. However `su' resets it's $PATH so you must use -p to tell it not to: sudo su -p –  username May 17 '09 at 14:40

Assuming the binary is in /usr/local/staf/bin, does "sudo /usr/local/staf/bin/STAF" work?

And, to rule out the obvious: the binary name is actually all uppercase?

What operating system is this? Do you know if anyone has tweaked your sudoers.conf? I assume it is changing your environment variables. In all default setups that I've seen though, $PATH isn't changed.

share|improve this answer
Yes, the command with full path works. I may have understand this a bit. It's probably because the /usr/local/staf/bin is not in the $PATH of root account, right? BTW, I'm using Ubuntu9.04 and I want to check if I'm correct, what is the root password? I've just installed the OS with my name as default account. –  eric2323223 May 17 '09 at 5:10
@eric2323223: In a default Ubuntu install sudo wants your user account password, not the root password. To change the root password do "sudo bash" and then "passwd". –  Dylan May 17 '09 at 5:15

Your Answer

