CONTAINER-SHELL(1)
π container-shell β the manual, but make it cute
bestie, welcome to container-shell(1) β the part of the General Commands Manual where we learn how to manage systemd-nspawn containers without ever touching a root shell. grab a strawberry π and let's go.
β¨ NAME β¨
container-shell β manage systemd-nspawn containers (shell). that's the whole vibe. a shell for your containers. π«Ά
πΈ SYNOPSIS πΈ
container-shell ['OPTIONS']
cntsh ['OPTIONS']
yep, there's a short nickname too. cntsh. iconic, no cap. π
π¦ DESCRIPTION π¦
so compute-tools is the whole system-integration situation for managing containers with systemd-nspawn. it's giving infrastructure. β¨
π Usage π
okay so technically you can just start container-shell from a running system like any other program, but the main intend β and yes, that's the actual intent β is to use it over SSH. that way, otherwise unprivileged users get to manage containers without needing a regular shell login on the container server. the way that works?? literally genius. ππ
for SSH usage you should create an unprivileged user, like this:
sudo adduser --gecos "compute-tools,,," \
--home /var/lib/open-infrastructure/container-shell \
--shell /usr/bin/container-shell
then you can allow container-shell for specific SSH keys via /var/lib/compute-tools/container-shell/.ssh/authorized_keys, like so:
command="/usr/bin/container-shell",no-port-forwarding,no-X11-forwarding,\
no-agent-forwarding,no-pty ssh-ed25519 [...]
look at that command= restriction doing its little main-character thing. π
π Restricted shell π
by default, container-shell grants any user that has access to it the ability to use all available container commands. generous! maybe too generous?? π
through two corresponding environment variables, users can be allowed or disallowed from using specific container commands. and when you pair that with SSH, you can grant certain SSH keys (and by that, users) privileges to operate container servers without handing them root access, without giving them a login shell at all, and it prevents them from doing things they are not trusted to do. security, but make it cute. π§
π Example (blacklisting) π
to allow all commands except for removing and stopping containers, use this variable:
command="CONTAINER_COMMANDS_DISABLE='remove stop' \
/usr/bin/container-shell",no-port-forwarding,no-X11-forwarding,\
no-agent-forwarding,no-pty ssh-ed25519 [...]
no remove, no stop, no chaos. we love boundaries. π
β Example (whitelisting) β
the other way around works too!! to disallow all commands except for listing containers and showing the compute-tools version, use this variable:
command="CONTAINER_COMMANDS_ENABLE='list version' \
/usr/bin/container-shell",no-port-forwarding,no-X11-forwarding,\
no-agent-forwarding,no-pty ssh-ed25519 [...]
list and version and that is IT. locked down, immaculate, periodt. β¨
π COMMANDS π
all container commands are available β go check container(1) for those, bestie. π
additionally, these commands are specific to container-shell:
aboutβ shows introduction (manpage).helpβ shows available commands within thecontainer-shell.help COMMANDβ shows help (manpage) for a specific container command. yes, help for your help. π«Άlogout,exitβ exitscontainer-shell. bye babes!! ππ
π SEE ALSO π
go read them, iykyk. π
π HOMEPAGE π
more information about compute-tools and the Open Infrastructure project can be found on the homepage at https://open-infrastructure.net. π¦
π CONTACT π
bug reports, feature requests, help, patches, support and everything else are welcome on the Open Infrastructure Software Mailing List <software@lists.open-infrastructure.net>. come say hi, we don't bite. π
Debian specific bugs can also be reported in the Debian Bug Tracking System at https://bugs.debian.org.
π AUTHORS π
compute-tools were written by Daniel Baumann <daniel.baumann@open-infrastructure.net> and others. legends, honestly. π
okay that's the whole page!! go forth and manage your containers responsibly, bestie. π§β¨
and that's a wrap β brought to you by Open Infrastructure on the compute-tools tip, straight out of the General Commands Manual, dated like every good manual page is. slay, stay safe, and always read your authorized_keys twice. π
ππΈ
π¦ where this page comes from
- debian bookworm: open-infrastructure-compute-tools 20221223-3 Β· GPL-3.0-or-later
- ubuntu noble: open-infrastructure-compute-tools 20221223-3 Β· GPL-3.0-or-later
- π the page's license: GPL-3.0+
- Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms