You are not logged in.

#1 2008-05-22 15:59:36

Abelian
Member
Registered: 2008-04-23
Posts: 63

Can only use certain commands as root?

When trying to run certain commands such as reboot, shutdown and iwconfig I get "command not found" yet running them as root presents no issues:

[16:50][adam@jesse ~]$ iwconfig
bash: iwconfig: command not found
[16:50][adam@jesse ~]$ su -
Password: 
[root@jesse ~]# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.



[root@jesse ~]#

any ideas? I did re-install earlier, but followed the same steps as first time and had no issues then so am a bit stumped...

Cheers for any help

Offline

#2 2008-05-22 16:24:28

Morra
Member
Registered: 2008-05-16
Posts: 39

Re: Can only use certain commands as root?

This could be a path related problem. What do you get when you run "echo $PATH" as a normal user and root? What is the output of "ls -l /usr/sbin/iwconfig"? What happens if you start programs with a full path?

Last edited by Morra (2008-05-22 16:25:39)

Offline

#3 2008-05-22 16:49:08

Abelian
Member
Registered: 2008-04-23
Posts: 63

Re: Can only use certain commands as root?

As root:

/bin:/usr/bin:/sbin:/usr/sbin:/opt/mozilla/bin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core

As normal user:

./:/bin:/usr/bin:/usr/local/bin:/usr/bin

You got it in one Morra, a path issue. any reason why they are not the same by default? Solved the issue by copying the root PATH into my .bashrc, but it would be nice to know why they aren't the same.

Offline

#4 2008-05-22 17:26:34

ghostHack
Member
From: Bristol UK
Registered: 2008-02-29
Posts: 261

Re: Can only use certain commands as root?

The default path is set in /etc/profile which is the first settings file read after you login.  Check to see whether there is a .pacnew of this file that should be merged.

Also, having the current directory (.) at the start of your path is not the best idea, if you must have it, put it at the end.

Offline

#5 2008-05-22 17:41:32

Abelian
Member
Registered: 2008-04-23
Posts: 63

Re: Can only use certain commands as root?

Those are just the defaults,  but have moved the current directory to the end as suggested.

No .pacnew hanging around. Cheers for the help so far.

Offline

#6 2008-05-22 17:49:40

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Can only use certain commands as root?

Programs residing in /sbin and /usr/sbin are (by unix standards) meant be only run as root. If you feel like you want to run them as a user, just add them to your PATH in ~/.profile or ~/.bashrc or such. Mostly you need root privileges to do something with them, although running for informational purposes (like 'iwconfig') doesn't require any special privileges.

Offline

Board footer

Powered by FluxBB