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

30,872

You need to run useradd with root privileges, for example by using sudo:

sudo -- useradd -c "test" -d /home/bbbbbbbb -e "01-jan-2013" -f 10 -g admin -p secretfgjdhdgd -s /bin/bash -u 123456 blobblob
Share:
30,872

Related videos on Youtube

Michael Durrant
Author by

Michael Durrant

Updated on September 18, 2022

Comments

  • Michael Durrant
    Michael Durrant over 1 year

    Trying to add a user:

    useradd -c "test" -d /home/bbbbbbbb -e "01-jan-2013" 
      -f 10 -g admin -p secretfgjdhdgd -s /bin/bash -u 123456 blobblob
    

    but getting:

    useradd: cannot lock /etc/passwd; try again later.
    
    • geirha
      geirha almost 12 years
      note that useradd's -p expects an encrypted password. Consider using newusers instead.