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 /
Jawa
three,549 xiii gold badges thirty silver badges 36 bronze badges
answered Oct 3, 2014 at 7:22
4
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
inquaminquam
293 1 argent bluecoat 8 bronze badges
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
LucLuc
2,343 2 gilded badges 23 silvery badges 33 bronze badges
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
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
Robin GreenRobin Green
one,253 1 gilt badge 12 silver badges 28 bronze badges
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 ofstrace
though. How wouldstrace
help me? Never used itApr 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
Eric LeschinskiEric Leschinski
6,448 6 gold badges 43 silver badges 49 bronze badges
answered May 19, 2017 at 23:45
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
Source: https://superuser.com/questions/296373/cannot-lock-etc-passwd-try-again-later
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