2019-04-30 11:12:26 +01:00
|
|
|
# nsenter
|
|
|
|
|
|
|
|
> Run a new command in a running process' namespace.
|
2024-03-14 05:01:06 +00:00
|
|
|
> Particularly useful for Docker images or chroot jails.
|
2022-05-08 22:26:45 +01:00
|
|
|
> More information: <https://manned.org/nsenter>.
|
2019-04-30 11:12:26 +01:00
|
|
|
|
2022-05-08 22:26:45 +01:00
|
|
|
- Run a specific command using the same namespaces as an existing process:
|
2019-04-30 11:12:26 +01:00
|
|
|
|
2022-05-08 22:26:45 +01:00
|
|
|
`nsenter --target {{pid}} --all {{command}} {{command_arguments}}`
|
2019-04-30 11:12:26 +01:00
|
|
|
|
2022-05-08 22:26:45 +01:00
|
|
|
- Run a specific command in an existing process's network namespace:
|
2019-04-30 11:12:26 +01:00
|
|
|
|
2022-05-08 22:26:45 +01:00
|
|
|
`nsenter --target {{pid}} --net {{command}} {{command_arguments}}`
|
2019-04-30 11:12:26 +01:00
|
|
|
|
2022-05-08 22:26:45 +01:00
|
|
|
- Run a specific command in an existing process's PID namespace:
|
2019-04-30 11:12:26 +01:00
|
|
|
|
2022-05-08 22:26:45 +01:00
|
|
|
`nsenter --target {{pid}} --pid {{command}} {{command_arguments}}`
|
|
|
|
|
|
|
|
- Run a specific command in an existing process's IPC namespace:
|
|
|
|
|
|
|
|
`nsenter --target {{pid}} --ipc {{command}} {{command_arguments}}`
|
2022-05-19 00:35:46 +01:00
|
|
|
|
|
|
|
- Run a specific command in an existing process's UTS, time, and IPC namespaces:
|
|
|
|
|
|
|
|
`nsenter --target {{pid}} --uts --time --ipc -- {{command}} {{command_arguments}}`
|
|
|
|
|
|
|
|
- Run a specific command in an existing process's namespace by referencing procfs:
|
|
|
|
|
|
|
|
`nsenter --pid=/proc/{{pid}}/pid/net -- {{command}} {{command_arguments}}`
|