Skip to content

Commit 53f9218

Browse files
authored
Fix sudo command failed because root user password expired by password hardening feature issue. (#220)
Fix sudo command failed because root user password expired by password hardening feature issue. #### Why I did it some sudo command failed after enable password hardening feature: admin@vlab-01:~$ sudo config reload -y sudo: Account or password is expired, reset your password and try again Changing password for root. Current password: This is because: 1. root user password change time is image build time. 2. password hardening feature will set expiration time smaller than 1 year, in sonic-mgmt test it's 100 days. 3. some SONiC command will run another commands, those sub-commands will run with root user. 4. any command run by 'root' user will be blocked and ask update password. 5. SONiC diabled the 'root' user, this user not have password, also can't login with SSH/Console, which means when ask change password by the sudo command, there is no way to provide the 'current' password user will be blocked there. The only solution is to run 'sudo passwd root' command, this command will not ask current password, so user can set a new root password. ##### Work item tracking - Microsoft ADO: 31221102 #### How I did it Remove the 'root' user expiration code. #### How to verify it Manually verified. Pass all test case. <!-- If PR needs to be backported, then the PR must be tested against the base branch and the earliest backport release branch and provide tested image version on these two branches. For example, if the PR is requested for master, 202211 and 202012, then the requester needs to provide test results on master and 202012. --> #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 - [ ] 202205 - [ ] 202211 - [ ] 202305 #### Tested branch (Please provide the tested image version) <!-- - Please provide tested image version - e.g. - [x] 20201231.100 --> will updated with this PR image later. - [] SONiC.master-16482.360728-2c8b4066f #### Description for the changelog Fix hostcfgd modify_single_file method generates empty file issue #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md --> #### A picture of a cute animal (not mandatory but encouraged)
1 parent 051218a commit 53f9218

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

scripts/hostcfgd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,6 @@ class PasswHardening(object):
10171017
if account_number >= uid_min and account_number <= uid_max:
10181018
normal_accounts.append(account_spl[ACCOUNT_NAME])
10191019

1020-
normal_accounts.append('root') # root is also a candidate to be age modify.
10211020
return normal_accounts
10221021

10231022
def modify_passw_conf_file(self):

0 commit comments

Comments
 (0)