PDA

View Full Version : /usr/sbin/useradd - why not just useradd?



melbs
22nd January 2009, 10:32 PM
I am new to Linux and I am following a book and using vmware with fedora9 for practice. It tells me to use "useradd", "groupadd", etc. Those do not work. I know that I can do "whereis command" and type the path given like: "/usr/sbin/useradd" and it will work--however, WHY does it make you type the entire path for the command? Is there a way to only have to type "useradd"? Thanks for any responses!

bd54338rre
22nd January 2009, 10:33 PM
you must be root to add users and/or groups

su -
[enter]

melbs
22nd January 2009, 10:36 PM
I am logged in as root.

melbs
22nd January 2009, 10:37 PM
Oh, before I just dd "su" and put in the root password. I was root then, but I did the "su -" and it worked.


What is the difference between me being root with "su" and with "su -"?

SlowJet
22nd January 2009, 10:40 PM
The path used to get useradd. :)
SJ

Hlingler
22nd January 2009, 10:40 PM
A common question: 'su' gives root user permissions; 'su -' also loads root user environment variables (like command PATH). Starting with F10, /sbin/ and /usr/sbin/ are in default user PATHs. You can also add them manually by editing ~/.bashrc and add to PATH line.

V

melbs
22nd January 2009, 10:47 PM
That makes sense, thanks a lot!!

scottro
22nd January 2009, 11:43 PM
Hopefully, this explanation might help a bit.

http://home.roadrunner.com/~computertaijutsu/rhpath.html

Note that it has changed in F10, with the various /sbin directories being added to the normal user path.