Skip to main content
Documentation Status https://coveralls.io/repos/github/jonhadfield/creds/badge.svg?branch=master https://circleci.com/gh/jonhadfield/creds.svg?style=svg https://travis-ci.org/jonhadfield/creds.svg?branch=master

Creds

Creds is a library that simplifies the management of user accounts and their credentials on Linux, FreeBSD and OpenBSD.

Instead of issuing commands to create, update and delete users and their ssh keys, supply Creds with details of the users you want and it will take care of the implementation.

The supported inputs are currently YAML, JSON or python dictionaries.

User vs System accounts

Linux has a default range of user ids to provide to system and user accounts, found in /etc/login.defs.
Creds will attempt to read this file to determine which accounts are in scope for management and, if unavailable, will default to:
UID_MIN = 1000 # User accounts will have an id of 1000 or more
UID_MAX = 60000 # User accounts will not have an id higher than 60000

Example Usage

Read a list of users from users.yml and create them (if missing) or update (if existing):

from creds.users import Users
from creds.plan import (create_plan, execute_plan)

existing_users = Users.from_passwd()  # Get a list of existing users and their keys
proposed_users = Users.from_yaml('users.yml')  # Read the proposed list of users and their keys

# Generate a list of operations to transition from current to existing
plan = create_plan(existing_users=existing_users, proposed_users=proposed_users)
execute_plan(plan=plan)  # Execute the plan

Deleting users

If your input defines all of the user accounts you want to exist, you can choose to purge any that are undefined by adding a parameter to create_plan:

plan = create_plan(existing_users=existing_users, proposed_users=proposed_users,
                   purge_undefined=True)

Protecting users

If there are users you want to protect from change, e.g. you want to make sure that certain users are not deleted or updated under any circumstances, then you can supply a list of usernames for Creds to ignore:

plan = create_plan(existing_users=existing_users, proposed_users=proposed_users,
                   purge_undefined=True, protected_users=['rod', 'jane', 'freddy'])

Metadata

Release files for creds 1.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for creds 1.0.16
File Size Uploaded
creds-1.0.16.tar.gz 26.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for creds 1.0.16
File Interpreter ABI Platform
creds-1.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 51.1 kB

Release files / creds-1.0.16.tar.gz

Download URL creds-1.0.16.tar.gz
Size 26.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7553178164cfe1f9a2043bc22c7ee156b6156bd82704418571cf1d8eb9cf1c51
BLAKE2b-256 checksum
How to use checksums
05e0fa0ff3435105239140587a13f838ca47b2a9b2289162db1ee4f226c73f6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / creds-1.0.16-py3-none-any.whl

Download URL creds-1.0.16-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c7d880ec7bc82751dd38051c862986d3b77e759c7b49d900cbe43c5b6ef5421
BLAKE2b-256 checksum
How to use checksums
34af1c23f3d6c8107750e6e5a375cd4dc6f69f4dbf669e23768a048afbb8312f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release history Release notifications | RSS feed

This release

1.0.16 This release

2 release files

1.0.15

1 release file

1.0.14

1 release file

1.0.13

1 release file

1.0.12

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page