Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  devnull Mar 15 '13 at 10:18

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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