2022年11月4日 星期五

[lxc, ssh] How to connect the lxd container using ssh?

How to connect the lxd container using ssh

井民全, Jing, mqjing@gmail.com

Quick

lxc list   # get your container list

lxc exec ubuntu-container -- apt-get install openssh-server


# verify

ssh ubuntu@10.199.76.115 

lxc exec ubuntu-container -- passwd ubuntu   # in case you forgot the passswd


Procedure

Step 1: Get the container list to know your container's name, ip

lxc list   # get your container list

E.g. 


Step 2: Install openssh server

lxc exec ubuntu-container -- apt-get install openssh-server

E.g.



Verification


ssh ubuntu@10.199.76.115


Note: If you forget the container user ubuntu's passwd, follow the instruction to change it.

lxc exec ubuntu-container -- passwd ubuntu