174
174
"""Return True if the host system uses systemd, False otherwise."""
175
175
return os.path.isdir(SYSTEMD_SYSTEM)
178
def adduser(username, uid=None, password=None, shell='/bin/bash',
179
system_user=False, primary_group=None, secondary_groups=None):
177
def adduser(username, password=None, shell='/bin/bash', system_user=False,
178
primary_group=None, secondary_groups=None, uid=None):
180
179
"""Add a user to the system.
182
181
Will log but otherwise succeed if the user already exists.
184
183
:param str username: Username to create
185
:param int uid: UID for user being created
186
184
:param str password: Password for user; if ``None``, create a system user
187
185
:param str shell: The default shell for the user
188
186
:param bool system_user: Whether to create a login or system user
189
187
:param str primary_group: Primary group for user; defaults to username
190
188
:param list secondary_groups: Optional list of additional groups
189
:param int uid: UID for user being created
192
191
:returns: The password database entry struct, as returned by `pwd.getpwnam`