can't run /sbin commands

Alex Zbyslaw xfb52 at dial.pipex.com
Thu Sep 15 02:10:28 PDT 2005


Dave Webster wrote:

>When I first installed FreeBSD I was able to run "halt" and "reboot" as
>su without the full /sbin/reboot command.  After adding a new path to
>PATH, I've been unable to run these commands without specifying the full
>path.  
>[...]
>Here is the output of echo $PATH:
>/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:
>/usr/X11R6/bin:/home/Dave/bin:/usr/home/Dave/apache-forrest-0.7/bin
>
>My question is with /sbin in the path why do I have to
>specify /sbin/reboot, /sbin/kldstat etc.?  Could this be causing my make
>install to fail?  How can /sbin be in the path and still require a full
>path declaration for it's commands to work.
>  
>
The short answer to your question is that if /sbin really were in your 
path you would be able to run programs from it, therefore /sbin is *not* 
in your path.  (Since you can run commands from /sbin with full path 
names it can't be file permissions or deleted programs).  Either that or 
something else on you path is somehow messing up your shell big-time, 
but that seems less likely.

You say that the problems started after you changed you path (I assume 
in your .profile or whatever).  So, quite simply, you must have made 
some kind of mistake.  I would suggest going back to the file you edited 
and starting again.  Comment out the PATH specification and add things 
back one at a time.  Assuming a /bin/sh or derivative, you can re-load 
your file with
    . filename

(for csh derivatives, use "source filename").

After each change you make, source the changes and see if you can run 
some innocuous program from /sbin such as kldstat.

--Alex



More information about the freebsd-questions mailing list