formats

useradd: cannot lock /etc/passwd; try again later.




Can’t add a user in Linux because of this: ‘useradd: cannot lock /etc/passwd; try again later.’ ? Here’s what to check!



$ sudo useradd -m -g users -s /bin/bash jsmith
useradd: cannot lock /etc/passwd; try again later.


If you receive this message even when running with sudo, there are small lock files that are causing this.


Remove any files called

/etc/passwd.lock
/etc/group.lock
/etc/gshadow.lock
/etc/shadow.lock


Careful to not remove the actual passwd or shadow files(!).

This error can also occur if the filesystem was mounted read-only. Check to be sure the file system is mounted read write.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Home linux useradd: cannot lock /etc/passwd; try again later.