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

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!

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

su -

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

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 -"?

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

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.


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

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


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