Skip to main content

Get the macOS console username and/or a list of local non-system users.

Project description

macusers

Get details on macOS user accounts.

>>> import macusers
# get the logged in user details.
>>> user = macusers.primary()
# get the logged in user's username.
>>> user.username
'bryanheinz'
# get logged in user's home folder as a `pathlib` object.
>>> user.home
PosixPath('/Users/bryanh')
# get a list of non-system user accounts.
>>> for user in macusers.users(False): print(user.username)
bryanheinz
morrismoss
# get a list of admin accounts.
>>> for admin in macusers.admins(False): print(admin.username)
bryanheinz
# check if the user has FileVault access. NOTE: requires admin.
>>> macusers.primary().fv_access()
True
# check if the user is an APFS volume owner.
>>> macusers.primary().apfs_owner()
True
# check if the user has a secure token.
>>> macusers.primary().secure_token_status()
True

This module is used to get the current or last (if the system currently doesn't have any logged in users) logged in console user on macOS instead of the user running the script/program.

This module now contains the following User properties:

  • username : The user's username
  • real_name : Full name
  • uid : The user's ID
  • gid : Primary group ID
  • guid : Generated user ID - used by APFS
  • home : Home folder
  • shell : Default shell
  • admin : If the user is an admin
  • ssh_access : If the user has SSH access
  • volume_owner : If the user is an APFS volume owner
  • secure_token : If the user has a secure token
  • created : Epoch time when the user was created
  • password_updated: Epoch time when the user's password was last changed

These properties can be accessed via User.PROPERTY e.g. macusers.primary().admin.

Installing

You can install macusers using pip. macusers has been tested with Python 3.7 and 3.9.

python3 -m pip install macusers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

macusers-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

macusers-1.0.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file macusers-1.0.0.tar.gz.

File metadata

  • Download URL: macusers-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for macusers-1.0.0.tar.gz
Algorithm Hash digest
SHA256 be9c5572d1004eec2b53c3b6cfd8255c96dd265935a6293fa7535c61cb43deba
MD5 96c999fa21c6de7774ffd24c218d6a56
BLAKE2b-256 80ceb11a05d40cf7dcf208f59b06d7fcde89cee86d84ab09e9db38fada453d1a

See more details on using hashes here.

File details

Details for the file macusers-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: macusers-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for macusers-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e7bcaf064ff3077796dc11ca6aa22cdb41c28a201fe1d9f27febee8ad27b5d5
MD5 0b352ff8b85b2368f245b5d582633d93
BLAKE2b-256 f9fd0353fa823a3482c9c36732f8079f85b2e00d1a888f8ad98a6926bf56b34a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page