passwd: permission denied error when trying to update a user's password
Hi all. I just installed Ubuntu on a new machine and everything seemed to be going fine. I and a coworker were having some issues with a few things and have managed to lock-out a local admin (sudo?) account after unjoining an AD domain using realm while troubleshooting some McAfee issues were were having. I'm 99.9% certain that the password has not changed for the user. I have followed ALL the steps found here for resetting the password as root in recovery. When I try to run
Code:
sudo passwd USERNAME Code:
root@HOSTNAME:~# sudo passwd USERNAME Code:
username:!:14920:0:99999:7::: |
Since you are already "root" there is no need to use "sudo" too. Try simply:
Code:
passwd USERNAME Please note that the tutorial you are following didn't say to use "sudo" either. |
@snowpine You are correct, but there's no reason for root not to be able to sudo. Just try it yourself. It's just redundant, but it has to work.
@OP What does /etc/pam.d/passwd look like? Do you encounter the same error when trying other commands that need privilege? |
Quote:
|
Now that I think about it, are you sure the you've mounted the root partition as writable? Maybe that's the reason why you get permission denied, you might have only read permissions. That's an essential part of the recovery process: mount -rw -o remount /
|
Quote:
Code:
mount -o remount,rw / |
Maybe you should make sure that the system is actually mouting the right partition. Do you find the correct users in /etc/passwd, for instance?
|
Quote:
When running /etc/passwd I got this: Code:
passwd: Permission denied Code:
-rw-r--r-- 1 root root 1046 Nov 21 14:29 /etc/passwd Code:
/etc/shadow: Permission denied Code:
-rw-r----- 1 root shadow 1310 Nov 21 14:29 /etc/shadow Code:
-rw------- 1 root root 823 Dec 7 19:59 /etc/shadow If it comes to it, can I reinstall Ubuntu from DVD and sort of run a "recovery" without loosing all my settings, programs, etc. Almost like a refresh without starting from scratch? |
I don't understand what you mean by "running" /etc/shadow. Shadow is a file. What did you run exactly?
First, let me get this straight, you haven't been able to change the root password, right? Are have you only tried to change the password for the admin user? You could try changing the password for the root and then boot normally into Ubuntu, log in with root, change the admin password and disable root (although, to be honest, there's no reason not to use the root directly, as it's done in Red Hat-based distros, but that's another subject). It doesn't really make much difference if /etc/shadow has the read permission or not. This is how it looks on Centos 7: ---------- 1 root root 1482 Oct 31 00:02 /etc/shadow So I wouldn't worry about that. That's not the problem. By the way, please tell us exactly what version of Ubuntu you're running. |
I'm thinking now that the problem might be related to the ldap authentication. Maybe when you invoke the passwd command, it's not really using /etc/shadow but some other file (trying to connect to the DC, etc.)
What does /etc/nsswitch.conf say? |
Quote:
Quote:
Code:
bash: /etc/nsswitch.conf: Permission denied Code:
-rw-r--r-- 1 root root 575 Nov 14 09:37 nssswitch.conf. |
Why are you trying to run a text file? :confused: You sure you are up to the task before you?
|
Quote:
|
Quote:
When I ask you what /etc/nsswitch.conf looks like, and I'm no expert in linux, I think it's implied that one would understand running cat /etc/nsswitch.conf, or less or more or whatever command you're comfortable with. |
Quote:
Quote:
The only exception to the rule are scripts, but we're not dealing with those here. Try: Code:
cat /etc/passwd Code:
cat /etc/shadow Code:
cat /etc/nsswitch.conf Code:
NAME |
All times are GMT -5. The time now is 08:43 AM. |