PDA

View Full Version : Simple commands like fdisk, ifconfig doesn't work.



spfdz
10th May 2006, 03:44 PM
For some reason, I can't get fairly basic commands to work.

ifconfig, fdisk (haven't tried others) don't work as root.

Any ideas?

Nord
10th May 2006, 03:56 PM
For ordinary users the "/sbin" and "/usr/sbin" paths are not in $PATH variable. Try to invoke the commands with full names, e.g. /sbin/ifconfig

bob
10th May 2006, 04:02 PM
Also, sign in as 'su -' instead of 'su' and they'll work.

spfdz
10th May 2006, 04:08 PM
Also, sign in as 'su -' instead of 'su' and they'll work.

Signing in as su - worked. Any idea why?

Seve
10th May 2006, 04:14 PM
Signing in as su - worked. Any idea why?
Have a quick read through here, it should help clear up some things.
http://www.fedorafaq.org/basics/#root
Seve

bob
10th May 2006, 04:15 PM
You know, I just typed out an explanation and then realized it made no sense to me either. I've always figured that as 'su' you were using root powers as a user, while 'su -' put you in full root at root's home. That's not technically correct of course, but it works for me. Guess we could wait for the knowledgeable folks to break in or use Google and find the correct answer.

pparks1
10th May 2006, 04:19 PM
su makes you root

su - (with a dash) makes you root and also loads root's path. Without the path, you cannot find /sbin and without /sbin you cannot run commands like ifconfig (unless you specify the absolute path..../sbin/ifconfig). By specifying the - after the su you tell the system to load that path and then when you type in ifconfig it will search the path and thus will find /sbin/ifconfig.


My suggestion to everybody, forget that su even exists and always type su -

If you want to make it easier, create a command alias so it always happens automatically for you with an su.

bob
10th May 2006, 04:31 PM
Yeah...what they said... :D Thanks, guys!