Merge pull request #2194 from AsahiLinux/passwd-fix

[users] Use usermod to disable passwords
This commit is contained in:
Adriaan de Groot 2023-09-03 21:19:01 +02:00 committed by GitHub
commit e6ce29ed33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,10 +83,10 @@ SetPasswordJob::exec()
if ( m_userName == "root" && m_newPassword.isEmpty() ) //special case for disabling root account
{
int ec = CalamaresUtils::System::instance()->targetEnvCall( { "passwd", "-dl", m_userName } );
int ec = CalamaresUtils::System::instance()->targetEnvCall( { "usermod", "-p", "!", m_userName } );
if ( ec )
return Calamares::JobResult::error( tr( "Cannot disable root account." ),
tr( "passwd terminated with error code %1." ).arg( ec ) );
tr( "usermod terminated with error code %1." ).arg( ec ) );
return Calamares::JobResult::ok();
}