Does anyone here use LXD/Incus? What do you do if you want to find the IP address of an instance, but incus list does not give you one? I am not sure what would be stopping one from being issued since that is how I have found that information before.

I am just a student trying to learn about them and do stuff. I often just find the IP of the container and then ssh in as that feels natural, but perhaps I am cutting against the grain here.

2 points
*

What do you do if you want to find the IP address of an instance, but incus list does not give you one?

If that’s the case then it means there’s no networking configured for the container or inside it. The image you’re using may not come with DHCP enabled or networking at all.

I often just find the IP of the container and then ssh in as that feels natural, but perhaps I am cutting against the grain here.

You are. You aren’t supposed to SSH into a container… it’s just a waste of time. Simply run:

lxc exec container-name bash # or sh depending on the distro

And you’ll inside the container much faster and without wasting resources.

permalink
report
reply
2 points

But that then leaves me as root, is there a way to just have a normal user? Or is that also not really intended?

permalink
report
parent
reply
4 points
*

Well, it’s a container, in most situations you would be running as root because the root inside the container is an unprivileged user outside it. So in effect the root inside the container will only be able to act as root inside that container and nowhere else. Most people simply do it that way and don’t bother with it.

If you really want there are ways to specify the user… but again there’s little to no point there.

lxc exec container-name --user 1000 bash 
lxc exec container-name -- su --shell /bin/bash --login user-name

For your convenience you can alias that in your host’s ~/.bashrc with something like:

lxcbash() { lxc exec "$1" -- sudo --login --user "$2"; }

And then run like:

lxcbash container-name user-name
permalink
report
parent
reply
3 points

I guess that does make sense. Part of what I had in mind was having different instance for different projects. I guess in my mind it gives me a reason to have and practice multiple as well as feeling cleaner (keeping compiler and stuff off host). I will try out your advice when I get home. Thank you so much!

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 7.7K

    Monthly active users

  • 6.5K

    Posts

  • 179K

    Comments