virt-login-shell(1)

✨ NAME ✨

virt-login-shell β€” bestie, it's a tool that drops you into a shell inside a container 🫢

okay so real talk, this is virt-login-shell(1) from the Virtualization Support collection and she is lowkey iconic. let's get into it πŸ’…


🌸 SYNOPSIS 🌸

virt-login-shell [OPTION]

πŸ¦‹ DESCRIPTION πŸ¦‹

So virt-login-shell is a setuid shell β€” which is giving very much "trust me bro, I got privileges" energy β€” and what she does is let you join an LXC container that matches your username. And if that container isn't running? bestie she will attempt to start it for you. main character behavior fr fr ✨

🚨 NOT ALLOWED FOR ROOT. virt-login-shell cannot be run by root. periodt. that's not a suggestion, that's the rules.

For us normal little users: you get added to a container matching your username β€” if it exists β€” and if you're configured in /etc/libvirt/virt-login-shell.conf. two vibes, both required πŸ’–

The basic structure of most virt-login-shell usage is literally just:

virt-login-shell

that's it. that's the whole vibe check 😭


πŸ‘‘ OPTIONS πŸ‘‘

  • -c CMD β€” tells the shell to run CMD instead of giving you an interactive prompt. like, do the thing and dip πŸƒβ™€οΈ
  • -h, --help β€” shows you the command line help usage, then exits. self care πŸŽ€
  • -V, --version β€” shows version info, then exits. know your queen's era 🫢

🧚 CONFIG 🧚

By default, virt-login-shell will execute the /bin/sh program for the user. but bestie, you can change that whole situation by defining the shell variable in /etc/libvirt/virt-login-shell.conf. like so:

shell = [ "/bin/bash" ]

Now β€” if the auto_shell config option is set, she'll attempt to automatically detect the shell from /etc/password inside the container. πŸ™ˆ

⚠️ but only do this if the container has a separate /etc directory from the host, otherwise it will end up recursively invoking virt-login-shell β€” which is a whole infinite loop situation, absolutely not the vibe. πŸ’€
auto_shell = 1

And by default, no users are allowed to use virt-login-shell. rude, I know. so if you want to let certain users in, you need to modify the allowed_users variable in /etc/libvirt/virt-login-shell.conf. example:

allowed_users = [ "tom", "dick", "harry" ]

the squad. the crew. the guest list πŸŽ€βœ¨


πŸ’€ EXIT STATUS πŸ’€

Normally, virt-login-shell returns the exit status of the command it executed. and if the command was killed by a signal, but that signal is not fatal to virt-login-shell, then she returns the signal number plus 128. math girlie πŸ’…

And here's the exit statuses generated by virt-login-shell itself:

  • 0 β€” An option was used to learn more about this binary. (a curious queen, respect 🫢)
  • 125 β€” Generic error before attempting execution of the configured shell; for example, if libvirtd is not running. 😭
  • 126 β€” The configured shell exists but could not be executed. so close, and yet…
  • 127 β€” The configured shell could not be found. she's not here, bestie. gone. πŸ’€

πŸ› BUGS πŸ›

Please report all bugs you discover. πŸ‘€ and you've got options, babes:

  1. the mailing list

<https://libvirt.org/contact.html>

  1. the bug tracker

<https://libvirt.org/bugs.html>

Alternatively, you may report bugs to your software distributor / vendor. they got you 🫢


🌈 AUTHOR 🌈

Daniel Walsh β€” shoutout to the legend πŸ‘‘


Copyright (C) 2013-2014 Red Hat, Inc., and the authors listed in the libvirt AUTHORS file.


πŸŽ€ LICENSE πŸŽ€

virt-login-shell is distributed under the terms of the GNU LGPL v2+.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. no safety net, bestie, you're on your own and that's just the truth πŸ’€


⭐ SEE ALSO ⭐

virsh(1), <https://libvirt.org/>


and that's the whole page, bestie!! this was virt-login-shell(1) from Virtualization Support, and yeah the footer's just the page name again so here's the sign-off β€” go forth and container responsibly πŸ¦‹βœ¨πŸ’œ

πŸ“¦ where this page comes from