I am working on CentOS 5.5.

When I run the useradd command as root, then its working.

But when I run the same command from one of the user, then it shows

-bash: /usr/sbin/useradd: Permission denied

Why all this happening?

I also added /usr/sbin in PATH.

I added user from root by following commands:

groupadd service
useradd -g service service
passwd service

I installed Operating System two three times, all the time it shows same error.

Help me please, I didn't understand why all this happening.

  • It would be better if you could split your question in 2. One question regarding useradd and one regarding vim. – Huygens Mar 15 '13 at 10:11
  • 1
    @Huygens ohk I will do that. – devsda Mar 15 '13 at 10:18

The command useradd needs some special privilege to modify the system settings. Hence, you get a permission denied when using it as a normal user.

To be able to call useradd from a normal user, you need to configure sudo. It is not too complicated, see this tutorial: http://quaid.fedorapeople.org/sudo-tutorial/ especially chapter 4.

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.