From what I see LXC/LXD is great for checking out different Linux distro’s.
But to get a good grip on how it is to use the distro in day-to-day work, you usually need to run as the normal (non-root) user.
To get the nonprivileged user console in a container spawned from the official Ubuntu image, I do:
Instead of defining this as a shell function, you can also define it as an lxc alias.
stgraber@castiana:~$ lxc ubuntu snapcraft
sudo: unable to resolve host snapcraft
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
ubuntu@snapcraft:~$ logout
But it asks for the password. And it doesn’t accept it, it fails with su: Authentication failure. I tested from within the container switching from unprivileged user to unprivileged user and I can login.
The user id I get it with id <username> --user, and also I double checked the /etc/ passwd file.
If I run it without the --user flag, I will simply log as root (no password asked).
How can I make lxc shell --user <user-id> launch the shell without asking me the password?
Aside feature request: support user name beside user id in the --user flag for the shell command.