Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,28 @@ You must also install VeraCrypt and ensure the VeraCrypt CLI is available on you

Mount operations may require administrator or sudo permissions depending on your OS and system configuration.

## Privileges (Linux/macOS)

By default, on Linux/macOS the wrapper prefixes VeraCrypt commands with `sudo`, preserving backward-compatible behavior. Two constructor parameters let you control this:

- `use_sudo` (default `True`): whether to prefix commands with `sudo`. Mounting and dismounting volumes generally require root, so keep `sudo` (or run the process elevated) for those. **Creating a file container does not require root**, so pass `use_sudo=False` for least-privilege, non-interactive volume creation.
- `sudo_non_interactive` (default `False`): when `use_sudo=True`, invoke `sudo -n` so it never prompts for a password. This avoids `sudo`'s interactive password prompt consuming the volume password from `stdin` (which would otherwise cause the call to fail in headless/non-interactive contexts).

```python
from veracrypt import VeraCrypt, FileSystem

# Least-privilege, non-interactive file-container creation (no root needed):
vc = VeraCrypt(use_sudo=False)
vc.create_volume("/home/user/secure/test.vc", "SecretPassword", 5 * 1024 * 1024, filesystem=FileSystem.EXFAT)

# Mounting needs root; keep sudo but never prompt (requires a passwordless sudo rule
# or an already-elevated process):
vc_mount = VeraCrypt(sudo_non_interactive=True)
vc_mount.mount_volume("/home/user/secure/test.vc", "SecretPassword", "/mnt/veracrypt")
```

These parameters are ignored on Windows.

## Usage

```python
Expand Down
7 changes: 7 additions & 0 deletions build/lib/veracrypt/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__title__ = "python-veracrypt"
__description__ = "A cross-platform Python wrapper for the VeraCrypt CLI."
__url__ = "https://github.com/srichs/python-veracrypt"
__version__ = "0.1.0"
__author__ = "srichs"
__author_email__ = "srichs@pm.me"
__license__ = "GNU GPL v3.0"
3 changes: 3 additions & 0 deletions build/lib/veracrypt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .veracrypt import Encryption, FileSystem, Hash, VeraCrypt, VeraCryptError

__all__ = ["Encryption", "FileSystem", "Hash", "VeraCrypt", "VeraCryptError"]
Loading
Loading