12

I created a Ubuntu container

lxc launch ubuntu images:ubuntu/xenial mycontainer

I can access the container using

lxc exec mycontainer bash

I found mysel logged in as root without asking any password

I see that there is a "ubuntu" user defined

How can I access a software installed in the container (e.g. webmin) which asks for a username and password?

What are the default passwords?

abu_bua
  • 11,333
Mirto Busico
  • 713
  • 4
  • 14
  • 32

2 Answers2

13

After creating container "first" need set password for user "ubuntu"

lxc exec first -- /bin/bash
passwd ubuntu
exit

Then you can attach to console(or ssh - if ssh installed and configured)

lxc console first

UPDATE: As Piter wrote "You don't even have to enter the bash-shell"

lxc exec first -- passwd ubuntu
  • 3
    You don't even have to enter the bash-shell: 'lxc exec first -- passwd ubuntu' worked for me as well. – Peter Gloor Sep 07 '18 at 08:49
  • @PeterGloor Thanks for the suggestion! I tried the command you mentioned, and it works as advertised. Terentev: Might you consider incorporating Peter's suggestion into your answer? – justathoughtor2 Aug 26 '19 at 06:16
1

The usual password for these kinds of things is: ubuntu with the username ubuntu

You may need to set the password using the command passwd (https://stackoverflow.com/questions/9596108/how-do-i-change-my-password-in-linux)

Hopefully this helps!