fabtools.user

Users

fabtools.user.exists(name)[source]

Check if a user exists.

fabtools.user.create(name, comment=None, home=None, create_home=None, skeleton_dir=None, group=None, create_group=True, extra_groups=None, password=None, system=False, shell=None, uid=None)[source]

Create a new user and its home directory.

If create_home is None (the default), a home directory will be created for normal users, but not for system users. You can override the default behaviour by setting create_home to True or False.

If system is True, the user will be a system account. Its UID will be chosen in a specific range, and it will not have a home directory, unless you explicitely set create_home to True.

If shell is None, the user’s login shell will be the system’s default login shell (usually /bin/sh).

Example:

import fabtools

if not fabtools.user.exists('alice'):
    fabtools.user.create('alice')

with cd('/home/alice'):
    # ...
fabtools.user.modify(name, comment=None, home=None, move_current_home=False, group=None, extra_groups=None, login_name=None, password=None, shell=None, uid=None)[source]

Modify an existing user.

Example:

import fabtools

if fabtools.user.exists('alice'):
    fabtools.user.modify('alice', shell='/bin/sh')

Project Versions

Table Of Contents

Previous topic

fabtools.system

Next topic

fabtools.utils

This Page