25

I installed CentOS 5.5 on my VMWare 8 recently and I am trying to add a new user on the system. I am unable to add the user unless I use su - option. I believe it has to do something with path not set properly.

I updated the path and here is what it looks like /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/uone/bin:/sbin

I believe the command is in /sbin dir which is already a part of path. Can anyone suggest me what else I might be missing?

4 Answers 4

41

Try adding /usr/sbin to your path.

4
  • Yep! That did the trick, Added it as priority location in path. Thanks mdpc :)
    – Atul
    Aug 3, 2014 at 6:54
  • 1
    How would I do that? There is already a PATH = something in my .bash_profile? How do i add another one?
    – xiaodai
    Dec 17, 2014 at 7:05
  • @xiaodai unix.stackexchange.com/a/26059/24354 Oct 20, 2015 at 18:41
  • 3
    Want to provide an example of that for this to be a complete answer?
    – Henry F
    Feb 28, 2017 at 4:01
17

I know the OP answer was solved, however for those who are running CentOS from within the docker container, which appears to be missing both adduser and useradd, the solution is to install shadow-utils (under root obviously):

yum install shadow-utils
6
/usr/sbin/useradd username -g groupname -d homedirectory
2
  • Its giving me error -bash: /usr/sbin/useradd: No such file or directory
    – Nishad Up
    Feb 20, 2018 at 7:51
  • same here @NishadUp
    – Stanley
    May 19, 2020 at 17:43
-2
whereis useradd

this is used to solve that problem

2
  • That only tries to find useradd, not install it.
    – Amint
    Mar 3, 2021 at 21:50
  • whereis: command not found
    – s3c
    Apr 20 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.