Python library for requesting root privileges
Project description
Elevate: Request Root Privileges
PyElevate is a small Python library that re-launches the current process with
root/admin. This is essentially a fork of BarneyGale's Elevate with some of the pull requests applied.
Usage
To use, call PyElevate.elevate() early in your script. When run as root, this
function does nothing. When not run as root, this function replaces the current
process (Linux, macOS) or creates a new process, waits, and exits (Windows).
There is also an elevated() function to check if the program is elevated.
This will output a boolean value, with True meaning the program is elevated and False meaning it's not.
from PyElevate import elevate, elevated
if not elevated():
input("Before: " + str(elevated()) + "\nPress enter to elevate")
elevate()
input("After:" + str(elevated()) + "\nPress enter to elevate")
exit(0)
On Windows, the new process's standard streams are not attached to the parent,
which is an inherent limitation of UAC. By default, the new process runs in a
new console window. To suppress this window, use
elevate(show_console=False).
On Linux and macOS, graphical prompts are tried before sudo by default. To
prevent graphical prompts, use elevate(graphical=False).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyelevate-0.1.2.tar.gz.
File metadata
- Download URL: pyelevate-0.1.2.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60b3b581e3735f83344e9d2d453592e05c36655d1dfad0024097ed38dbdcf7d6
|
|
| MD5 |
42b484a46b1cac1a36b88b19799e69be
|
|
| BLAKE2b-256 |
a883ce507743f25c5f5aed23c59d9eab4a8e3f0729e8ac436990cab13a9eb03c
|
Provenance
The following attestation bundles were made for pyelevate-0.1.2.tar.gz:
Publisher:
python-publish.yml on gabrielzv1233/PyElevate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyelevate-0.1.2.tar.gz -
Subject digest:
60b3b581e3735f83344e9d2d453592e05c36655d1dfad0024097ed38dbdcf7d6 - Sigstore transparency entry: 238787638
- Sigstore integration time:
-
Permalink:
gabrielzv1233/PyElevate@34a769666d7b6741f4562a5dacf13cb8a8942ec1 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/gabrielzv1233
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@34a769666d7b6741f4562a5dacf13cb8a8942ec1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyelevate-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyelevate-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abac5a164bc496d802a55975f003813e369ffe3d3a03a3f2bbedc69b080c75fb
|
|
| MD5 |
9a48b5c81b9b65e8730be3903f98787b
|
|
| BLAKE2b-256 |
1a19e60620564d1e18e7b78303f1e7dee84fd23c55c4dbd15c08a5957cc6aa3b
|
Provenance
The following attestation bundles were made for pyelevate-0.1.2-py3-none-any.whl:
Publisher:
python-publish.yml on gabrielzv1233/PyElevate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyelevate-0.1.2-py3-none-any.whl -
Subject digest:
abac5a164bc496d802a55975f003813e369ffe3d3a03a3f2bbedc69b080c75fb - Sigstore transparency entry: 238787639
- Sigstore integration time:
-
Permalink:
gabrielzv1233/PyElevate@34a769666d7b6741f4562a5dacf13cb8a8942ec1 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/gabrielzv1233
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@34a769666d7b6741f4562a5dacf13cb8a8942ec1 -
Trigger Event:
release
-
Statement type: