Discussion:
[PVE-User] Can't login to LXC containers
Filippo Valsorda
2015-07-29 17:57:15 UTC
Permalink
Hello, I am on the 4.0 beta.

I started a container, typed a password in the first screen, and chose
the Ubuntu 14.04 template.

Now I don't know how to login. If there is a default user name it's not
"ubuntu". If that password becomes the root password, then I have a
problem because I looked inside the template, and sshd_config has
"PermitRootLogin without-password".

I feel dumb asking such a simple question, but: how am I supposed to log
in to a LXC container?
Dietmar Maurer
2015-07-29 18:16:10 UTC
Permalink
Post by Filippo Valsorda
Now I don't know how to login. If there is a default user name it's not
"ubuntu". If that password becomes the root password, then I have a
problem because I looked inside the template, and sshd_config has
"PermitRootLogin without-password".
It the root password - just open a console on the GUI to login.
Martin Maurer
2015-07-29 18:22:56 UTC
Permalink
Post by Dietmar Maurer
It the root password - just open a console on the GUI to login.
Yes, thats also a way :-). As the console is independant from sshd settings.
--
Best Regards,

Martin Maurer

***@proxmox.com
http://www.proxmox.com

____________________________________________________________________
Proxmox Server Solutions GmbH
Kohlgasse 51/10, 1050 Vienna, Austria
Commercial register no.: FN 258879 f
Registration office: Handelsgericht Wien
Martin Maurer
2015-07-29 18:17:58 UTC
Permalink
Post by Filippo Valsorda
Hello, I am on the 4.0 beta.
I started a container, typed a password in the first screen, and chose
the Ubuntu 14.04 template.
Now I don't know how to login. If there is a default user name it's not
"ubuntu". If that password becomes the root password, then I have a
you specify the root password on creation.
Post by Filippo Valsorda
problem because I looked inside the template, and sshd_config has
"PermitRootLogin without-password".
I feel dumb asking such a simple question, but: how am I supposed to log
in to a LXC container?
go got the proxmox ve host.
Post by Filippo Valsorda
pct list
pct enter VMID
now you can configure whatever you need, further users, sshd, etc.

best,

Martin
Wolfgang Bumiller
2015-07-30 05:57:25 UTC
Permalink
Post by Filippo Valsorda
Now I don't know how to login. If there is a default user name it's not
"ubuntu". If that password becomes the root password, then I have a
problem because I looked inside the template, and sshd_config has
"PermitRootLogin without-password".
This disables password authentication for root, so you need an
alternative, eg an ssh-key.

There are several ways to enter a container:
1) ssh - if the container ships with it activated. In your case you need
to first setup an ssh key for root in the container's
/root/.ssh/authorized_keys file. (If you do that, take care to get the
permissions right as sshd refuses to work with insecure key files.)

2) a console (web gui, `pct console`, or `lxc-console`)
This will put you onto a tty, which means the container needs to have a
login available on that tty, and if you want to login as root, this tty
needs to allow root to login (ie the tty needs to be trusted (listed in
/etc/securetty)).

3) directly attach from the commandline via `pct enter` or `lxc-attach`
This directly enters the namespaces and runs a shell, no login required,
you need to be logged in as root on the host to be able to do that, and
it's the easiest way to debug the container quickly. (No restrictions
from /etc/securetty or sshd_config apply here).
Post by Filippo Valsorda
I feel dumb asking such a simple question, but: how am I supposed to log
in to a LXC container?
There are many ways, and all of them have their quirks. sshd settings,
/etc/securetty etc. regularly leave people puzzled for a while until
they realize what's going on ;-)

And then there can always be "special" templates which eg. run
cloud-init or other autoconfiguration tools at start, and might have a
nasty configuration which at some point changes root's password or ssh
key or disables direct root login entirely.
It's hard to know about all the different possibilities out there.
Loading...