0
[root@notebook ~]# grep USER /etc/shadow
USER:!!:16577:1:90:7:::
[root@notebook ~]# 
[root@notebook ~]# su - USER
[USER@notebook ~]$ id
uid=1000(USER) gid=983(GROUPN) groups=983(GROUPN),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[USER@notebook ~]$ passwd
Changing password for user USER.
Changing password for USER.
(current) UNIX password: 
passwd: Authentication token manipulation error
[USER@notebook ~]$ 

Question: I am a normal user on a RHEL machine. How can I change my password without root permission?

When it asks for current pw at pw change, I just hit ENTER, because there is no password set, see the "!!".

4
  • 1
    What happens if you change it as root? passwd USER
    – Matteo
    Feb 5, 2016 at 11:41
  • I dont have root. If I would have root permission, I could of course change it. Feb 5, 2016 at 12:25
  • Than update your question ....
    – Matteo
    Feb 5, 2016 at 12:26
  • 1
    @LoukiosValentine79 You do have root. At least, that's what you showed us in the output. You need root to su - USER
    – Otheus
    Feb 5, 2016 at 13:29

2 Answers 2

2

You cannot, at least you must have sudo access or USER must have sudo privilege.

4
  • You don't need root access to change your own user's password!
    – terdon
    Feb 5, 2016 at 13:40
  • 1
    @terdon yeah, you do if the account is locked (encrypted password starts with !)
    – Otheus
    Feb 5, 2016 at 13:52
  • @Mahesh your answer is not quite correct for the general case.
    – Otheus
    Feb 5, 2016 at 13:52
  • 1
    @Otheus doh! Completely missed the !!, I thought the OP had just redacted the password hash.
    – terdon
    Feb 5, 2016 at 13:57
1

The problem in this case is, there isn't a valid password to specify as the existing one. The passwd command allows root to change passwords of other users without entering the original password. You can modify sudoers (as root of course) to allow this user to change the password for that user:

USER ALL = (root) NOPASSWD: /usr/bin/passwd USER

There is at least one weakness to this approach: the user can override system safeguards against poor, stupid passwords.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .