Add user to groups separately from useradd.

This commit is contained in:
Teo Mrnjavac 2016-10-27 15:25:36 +02:00 committed by Philip
parent f71602ec6c
commit a2c7256406

View File

@ -153,8 +153,6 @@ CreateUserJob::exec()
"-s",
"/bin/bash",
"-U",
"-G",
defaultGroups,
"-c",
m_fullName,
m_userName } );
@ -164,6 +162,18 @@ CreateUserJob::exec()
tr( "useradd terminated with error code %1." )
.arg( ec ) );
ec = CalamaresUtils::System::instance()->
targetEnvCall( { "usermod",
"-aG",
defaultGroups,
m_userName } );
if ( ec )
return Calamares::JobResult::error( tr( "Cannot add user %1 to groups: %2." )
.arg( m_userName )
.arg( defaultGroups ),
tr( "usermod terminated with error code %1." )
.arg( ec ) );
ec = CalamaresUtils::System::instance()->
targetEnvCall( { "chown",
"-R",