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 logged in as root and created a new account:

# useradd -d /home/onie -m onie
# su onie

Now I try to set the password for onie myself using the passwd command, but it's asking for my current password when I don't have one!

share|improve this question
    
It seems that only root can change the password for the new user. –  John Jun 16 '11 at 7:34
    
You might want to use the interactive option, adduser –  jasonwryan Jun 16 '11 at 7:42
add comment

1 Answer 1

up vote 8 down vote accepted

If you don't specify a password when running useradd (-p PASSWORD), it disables the password on that account; the only way to login to it is through some other authentication method (e.g. SSH keys), or by suing from root. Since passwords are disabled, you can't set a new one as a regular user. Root can change anyone's password without needing the current password though, so run:

[root@myhost ~]# passwd onie
share|improve this answer
add comment

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.