Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regular users expired password reset issue #534

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chmmeng
Copy link

@chmmeng chmmeng commented Nov 7, 2024

When PASSWD_NEEDS_USERNAME is enabled and a password expires, a regular user like test will see the error: passwd: Only root can specify a user name upon login. Allowing regular users to change their own password is a reasonable requirement, so when PASSWD_NEEDS_USERNAME is enabled, a condition needs to be added to address this.

@djmdjm
Copy link
Contributor

djmdjm commented Nov 7, 2024

On which platform did you experience this? AFAIK the existing code is correct for some of the three platforms where PASSWD_NEEDS_USERNAME is enabled (Solaris, UnixWare, OpenServer)

@chmmeng
Copy link
Author

chmmeng commented Nov 10, 2024

I encountered this issue on a CentOS-like platform. Unlike Solaris, UnixWare, and OpenServer, CentOS doesn’t require PASSWD_NEEDS_USERNAME for standard users, as only root can specify a username with passwd. This difference seems to cause unexpected behavior in our environment.

@djmdjm
Copy link
Contributor

djmdjm commented Nov 10, 2024

I'm more confused now - no Linux variant sets PASSWD_NEEDS_USERNAME in configure, are you setting it manually? If so, why?

@chmmeng
Copy link
Author

chmmeng commented Nov 13, 2024

yes,we set it manually to resolve a bug.
there are two users: root and sysop uid=0,and the sysop account has expired. When logging in as sysop, it prompts to change the root password instead of the sysop password. Here are the steps

  1. useradd sysop
  2. Edit /etc/passwd, change the UID and GID of the sysop user to 0, save and exit.
  3. passwd sysop to set a password for the sysop user.
  4. Log in via SSH using the sysop account.
  5. Exit the SSH session.
  6. As root, execute passwd -e sysop to expire the sysop password.
  7. SSH into the server using the sysop account. It prompts to reset the password, but the username mentioned is root, not sysop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants