Useradd Permission Denieduseradd Cannot Lock etcpasswd

9 Answers nine

If no .lock files are present only you lot nevertheless cannot create a user endeavour the following

                sudo mount -o remount,rw /                              

If logged in every bit root then use

                mountain -o remount,rw /                              

user avatar

Jawa

three,549 xiii gold badges thirty silver badges 36 bronze badges

answered Oct 3, 2014 at 7:22

user avatar

4

  • This solved the effect I had after booting into recovery mode by editing the chow entry

    Feb 1, 2017 at 8:16

  • but where shall one expect for the .lock files? thanks to @trevorRobinson information technology seems 1 should await in /etc/, correct?

    Feb xiii, 2017 at thirteen:32

  • What if it says mountain: cannot remount /dev/dm-0 read-write, is write-protected. I'm in ChromeOS (Linux) with Dev Mode enabled.

    April 22, 2017 at 5:51

  • Why isn't this the accepted answer??

    Jul 20, 2017 at vii:22

The user you are running the commands equally lack the required privileges. Alter to root user by issuing the control

              su -                          

or if you take/employ sudo

              sudo <command to run>                          

answered Jun 13, 2011 at 7:18

user avatar

If you accept -R /some/chroot added to your useradd control, that might exist the problem.

I thought it meant that the user would be jailed upon login, but that'due south not the case. Past looking at strace output, I saw useradd chrooted into the specified directory, after which of course it cannot discover /etc/passwd anymore. And then I'one thousand not sure what the choice is for, but at that place's your (well, my) problem.

answered Jun 17, 2017 at xx:17

user avatar

2

  • This was exactly what I was trying. After removing the -R [dir] option I was able to create the user.

    Oct 11, 2018 at 18:55

  • Prissy guess! Thank yous. I also understood that the chroot for useradd is not what yous think information technology is :) It only uses the specified dir as a root for the user'southward system. It'south useful for cloned isolated sub-OS, which is rarely what yous desire...

    Sep 7, 2019 at 13:45

That's because you lot don't have permissions for those operations

  • You tin can't read /etc/shadow
  • You tin't directly modify /etc/passwd

You can change both files through specialized commands (e.1000 you can alter your password).

answered Jun thirteen, 2011 at 7:16

1

  • to change password, use " passwd <username> "

    Jun xiii, 2011 at 7:21

I ran into this when a disk mistake occurred during a userdel operation and the system had to be rebooted. I needed to delete all four of the following files to keep:

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

answered Aug 2, 2012 at 21:20

user avatar

This can likewise be acquired by running out of infinite on the root filesystem. Use strace to exist sure. strace is your friend.

answered January 28, 2012 at 22:12

user avatar

ii

  • I've been reading many threads with my problem and that was actually the solution. Should be one of the starting time things to bank check when having any filesystem problems, I guess. I'g using df instead of strace though. How would strace help me? Never used it

    Apr xiv, 2014 at ten:eleven

  • Well, if you already guessed that the trouble might be running out of space, so df can help. Merely strace will tell you lot what the error lawmaking was when it tried to lock the file, so it should remove the guesswork. The style I unremarkably phone call strace is strace -f -e trace=file command since this usually gives the virtually useful results.

    Apr 14, 2014 at 11:03

A demo of this mistake on Ubuntu 14.04:

              user@mybox:/home$ sudo useradd eric user@mybox:/abode$ userdel eric userdel: Permission denied. userdel: cannot lock /etc/passwd; attempt once again later.                          

sudo gives you lot the permission to lock information technology.

              user@mybox:/domicile$ sudo userdel eric user@mybox:/domicile$                          

answered Sep 17, 2014 at twenty:45

user avatar

answered May 19, 2017 at 23:45

user avatar

Had same upshot, since /etc was full. This is why /etc/passwd could not be written. Make sure that you lot have plenty space on /etc, if not then enlarge it or clean unnecessary stuff.

answered Jan 3, 2018 at 15:39

user avatar

smithcolmilluke.blogspot.com

Source: https://superuser.com/questions/296373/cannot-lock-etc-passwd-try-again-later

0 Response to "Useradd Permission Denieduseradd Cannot Lock etcpasswd"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel