Skip to main content

pysyslimit

PyPI PyPI - Python Version Loc Comments

Docs Deploy Code Test Badge Creation Package Release codecov

GitHub stars GitHub forks GitHub commit activity GitHub issues GitHub pulls Contributors GitHub license

pysyslimit is a light-weight library which can manage the permission in linux system.

Installation

Just install this package with the pip command

pip install pysyslimit

For further information, take a look at the Installation Page.

Quick Start

Please attention that many function in this library need root permission, so It is strongly recommended to run this with root.

Take a look at who I am

from pysyslimit import *

if __name__ == "__main__":
    print("current user:", SystemUser.current())
    print("current user's groups:", SystemUser.current().groups)
    print("current group:", SystemGroup.current())

The output should be

current user: root
current user's groups: [<SystemGroup root, id: 0>]
current group: root

Get and update the permission of files

from pysyslimit import *

if __name__ == "__main__":
    print(FilePermission.load_from_file("test_file"))

    chmod_del("test_file", "004")
    print(FilePermission.load_from_file("test_file"))

    chmod_add("test_file", "014")
    print(FilePermission.load_from_file("test_file"))

The output shall be

rw-rw-r--
rw-rw----
rw-rwxr--

Do calculation between permissions

from pysyslimit import *

if __name__ == "__main__":
    print(FilePermission.loads('463') + FilePermission.loads('615'))
    print(FilePermission.loads('463') | FilePermission.loads('615'))  # the same as +
    print(FilePermission.loads('463') - FilePermission.loads('615'))
    print(FilePermission.loads('463') & FilePermission.loads('615'))

The output shall be

rw-rwxrwx
rw-rwxrwx
---rw--w-
r-------x

Contributing

We appreciate all contributions to improve pysyslimit ,both logic and system designs. Please refer to CONTRIBUTING.md for more guides.

License

pysyslimit released under the Apache 2.0 license.

Metadata

Release files for pysyslimit 0.5.0

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

Source distribution (sdist)

Source distribution for pysyslimit 0.5.0
File Size Uploaded
pysyslimit-0.5.0.tar.gz 17.6 kB Details

Built distribution (wheel)

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

Total release size: 40.7 kB

Release files / pysyslimit-0.5.0.tar.gz

Download URL pysyslimit-0.5.0.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3d75d5e4fe7ac23250b16db215a73a8056238b33a8970507edf1befe227a1d06
BLAKE2b-256 checksum
How to use checksums
d84aa1fa1e3245da2daad02e01ea2dc60452b645f4d317491995b1db44a6cbcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / pysyslimit-0.5.0-py3-none-any.whl

Download URL pysyslimit-0.5.0-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85be9e35608a07ab7e31a5d0902a81e8637f46c29b01ca64085928096ab89ad8
BLAKE2b-256 checksum
How to use checksums
ba62f248858790a4d4175055908f581defaf031c208c4d81b1e30beecd09e2a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

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