Skip to content

user

user

user allows you to create and remove containers and associations, as well as enter shells in containers. It also happens to have a trick up its sleeve, which allows you to reproduce your system easily through a simple config file (skip to section).

Containers

Here’s how you can create a Debian container named ‘my-first-container’.

Terminal window
user create-container my-first-container debian

After its creation is complete, you’ll find that all of its binaries will be available on the host with the suffix .my-first-container. For example (terminal window on the host):

  • apt -> apt.my-first-container
  • dpkg -> dpkg.my-first-container
  • bash -> bash.my-first-container

Removing containers

Just run:

Terminal window
user remove-container debian

Entering containers

There are multiple ways in which you can enter a container. The first one is to use user to enter a container, as below (terminal window on the host):

Terminal window
user enter my-first-container

The second would be to run bash.my-first-container in a regular shell.

Associations

You might be tired of running apt.my-first-container all the time, in which you can shorten it to apt by simply running the following command (terminal window on the host):

Terminal window
user associate apt my-first-container

You can now install a package with sudo apt install [pkg] from a regular shell now.

Removing associations

Just run:

Terminal window
user dissociate my-first-container

Writing a configuration and importing it on other systems

Here’s what a sample configuration looks like:

modules:
ssh:
enabled: true
# allowed_keys: [YOUR_SSH_PUBLIC_KEY_HERE]
gnome:
enabled: true
style: light
gtk-theme: 'adw-gtk3'
icon-theme: 'Adwaita'
titlebar:
button-placement: 'right'
double-click-action: 'toggle-maximize'
middle-click-action: 'minimize'
right-click-action: 'menu'
containers:
# Containers go here
ubuntu:
distro: ubuntu-23.04
packages:
- brz
- devscripts
commands:
- 'echo "info: commands provided as strings, like this one, are run with bash"'
debian:
distro: debian
packages:
- git
- cowsay
- live-build
commands:
- sudo ln -sf ../../games/cowsay /usr/bin/cowsay
- sudo ln -sf ../../games/cowthink /usr/bin/cowthink
- ['cowsay', 'commands provided in the form of a list, like this one, are executed directly inside containers']
kali:
distro: kali-linux
packages:
- metasploit-framework
associations:
# Associations go here
apt: ubuntu
hello: ubuntu
debuild: ubuntu
git: debian
lb: debian
msfconsole: kali

Applying a configuration

Simply save the above config to a file named user.yaml, and run user cadre [PATH TO FILE], where [PATH TO FILE] is the path to user.yaml.

If you want to understand what the above config does, read on.

Modules

Each of modules come under the modules section in the config, and enabled must be set to true for each of them, as you might have noticed in the above configuration.

SSH

authorized_keys: # list of SSH keys

GNOME

style: # system-wide style, light or dark
gtk-theme: # theme to use
icon-theme: # icon theme to use
titlebar:
button-placement: # left or right
# the next three options support the following values: toggle-maximize | toggle-maximize-horizontally
# | toggle-maximize-vertically | minimize | none | lower | menu
double-click-action:
middle-click-action:
right-click-action:

Containers

Each of the containers should come under the containers section in the config, and be in the following format:

container_name:
distro: container_distro # this could be in arch | crystal-linux | ubuntu-22.04 | ubuntu-23.04 | debian | neurodebian-bookworm | kali-linux | almalinux-9 | fedora-38 | rocky-linux
packages:
- package1
- package2
- package3
commands:
- echo 'This is the first command that will be run in the container after the packages are installed.'
- ['echo', 'And this is the second command that will be run in the container after the packages are installed.']

Spot the difference between the two commands. The first one is a simple string, and is thus equivalent to:

['bash', '-c', 'echo \'This is the first command that will be run in the container after the packages are installed.\'']

The second one is in a list, and is executed directly instead of in a shell.

Associations

As with the two mentioned previously, each of the associations should come under the associations section in the config.

Each association should be in the format:

bin_name: container_name