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
  • 10,473
  • 10
  • 45
  • 62
Mirto Busico
  • 703
  • 4
  • 12
  • 31

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
Terentev Maksim
  • 1,257
  • 10
  • 11
  • 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
2

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!

Ben Clark
  • 36
  • 4
  • 7
    This doesn't appear to be the case for 18.04 LTS; the user appears to be `ubuntu`, but when I enter `ubuntu` as the password, it rejects it. – code_dredd May 29 '18 at 18:27