[users] Introduce userShell setting
- Add a *userShell* key, which can be left out (default, backwards- compatible) to retain the old /bin/bash behavior, or explicitly set to empty to defer to useradd-configuration, or explicitly set to something non-empty to use that shell.
This commit is contained in:
parent
ed15edabf9
commit
0d24c1db6c
@ -147,7 +147,9 @@ CreateUserJob::exec()
|
||||
}
|
||||
|
||||
QStringList useradd{ "useradd", "-m", "-U" };
|
||||
// TODO: shell-settings
|
||||
QString shell = gs->value( "userShell" ).toString();
|
||||
if ( !shell.isEmpty() )
|
||||
useradd << "-s" << shell;
|
||||
useradd << "-c" << m_fullName;
|
||||
useradd << m_userName;
|
||||
|
||||
|
@ -22,9 +22,11 @@
|
||||
|
||||
#include "UsersPage.h"
|
||||
|
||||
#include "utils/CalamaresUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "JobQueue.h"
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( UsersViewStepFactory, registerPlugin<UsersViewStep>(); )
|
||||
|
||||
@ -181,5 +183,12 @@ UsersViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
m_widget->addPasswordCheck( i.key(), i.value() );
|
||||
}
|
||||
}
|
||||
|
||||
QString shell( QLatin1Literal( "/bin/bash" ) ); // as if it's not set at all
|
||||
if ( configurationMap.contains( "userShell" ) )
|
||||
shell = CalamaresUtils::getString( configurationMap, "userShell" );
|
||||
// Now it might be explicitly set to empty, which is ok
|
||||
|
||||
Calamares::JobQueue::instance()->globalStorage()->insert( "userShell", shell );
|
||||
}
|
||||
|
||||
|
@ -74,3 +74,12 @@ passwordRequirements:
|
||||
libpwquality:
|
||||
- minlen=0
|
||||
- minclass=0
|
||||
|
||||
# Shell to be used for the regular user of the target system.
|
||||
# There are three possible kinds of settings:
|
||||
# - unset (i.e. commented out, the default), act as if set to /bin/bash
|
||||
# - empty (explicit), don't pass shell information to useradd at all
|
||||
# and rely on a correct configuration file in /etc/default/useradd
|
||||
# - set, non-empty, use that path as shell. No validation is done
|
||||
# that the shell actually exists or is executable.
|
||||
# userShell: /bin/bash
|
||||
|
Loading…
Reference in New Issue
Block a user