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 37df041b9c
commit c61e53edf7

View File

@ -153,8 +153,6 @@ CreateUserJob::exec()
"-s", "-s",
"/bin/bash", "/bin/bash",
"-U", "-U",
"-G",
defaultGroups,
"-c", "-c",
m_fullName, m_fullName,
m_userName } ); m_userName } );
@ -164,6 +162,18 @@ CreateUserJob::exec()
tr( "useradd terminated with error code %1." ) tr( "useradd terminated with error code %1." )
.arg( ec ) ); .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()-> ec = CalamaresUtils::System::instance()->
targetEnvCall( { "chown", targetEnvCall( { "chown",
"-R", "-R",