Skip to main content

NSEnter

Travis CI build status

This Python package allows entering Linux kernel namespaces (mount, IPC, net, PID, user and UTS) by doing the “setns” syscall. The command line interface tries to be similar to the nsenter C program.

Requires Python 2.6 or higher

See the introductory blog post “Entering Kernel Namespaces from Python”.

Install from PyPI:

sudo pip3 install nsenter

Install from git source:

python3 setup.py install

Example command line usage:

docker run -d --name=redis -t redis
sudo nsenter --all --target=`docker inspect --format '{{ .State.Pid }}' redis` /bin/bash

Example usage from Python:

import subprocess
from nsenter import Namespace

with Namespace(mypid, 'net'):
    # output network interfaces as seen from within the mypid's net NS:
    subprocess.check_output(['ip', 'a'])

# or enter an arbitrary namespace:
with Namespace('/var/run/netns/foo', 'net'):
    # output network interfaces as seen from within the net NS "foo":
    subprocess.check_output(['ip', 'a'])

Metadata

Release files for nsenter 0.2

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

Source distribution (sdist)

Source distribution for nsenter 0.2
File Size Uploaded Provenance
nsenter-0.2.tar.gz 4.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 16.6 kB

Release files / nsenter-0.2.tar.gz

Download URL nsenter-0.2.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
876a18cb03de85948e4cd72fd4cfda4879561b7264f5722603f6437d452a25cb
BLAKE2b-256 checksum
How to use checksums
a5461bfe9cca7f2e12cb2d7d9082b14feb785bc63628fb795a34d53ef57a8b93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nsenter-0.2-py3-none-any.whl

Download URL nsenter-0.2-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d44ba70199f9b454139f2093141e63218bca5b1285c65fcf6e4b139116088867
BLAKE2b-256 checksum
How to use checksums
8d6d65e257cd8cc42a68894292e28c8d25dcb5a6b8f959cfdd8c69cdc555efd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for nsenter 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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