Need help?

Our experts will login to your server within 30 minutes to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price per month.

How to SSH to LXC containers?

Wanna know how to SSH to LXC containers directly? We can help you.

We can log in to the LXC container directly using SSH.

At Bobcares, we often get requests from our customers regarding the LXC container as part of our Server Management Services.

Today, we’ll see how our Support Engineers SSH to LXC containers and fix its related errors.

How to SSH to LXC containers

To get the IP address of the containers we use the below command. The command will display only the IP address of the container.

lxc-info -n container-name -iH

For the latest version, we use the following command

lxc info container-name

Once we get the IP address.

Then we check if the PermitRootLogin is enabled in the server or not.

After we check the information we log out from the server. Then we try to connect to the containers using the below command.

ssh lxcuser@container_ip_address

Here we enter the password to access the containers.

 

Common errors while we SSH to LXC containers

Recently one of the customers contacted us saying he was unable to ssh to his LXC containers. Let’s now discuss how our Support Engineers resolve this problem.

 

No PermitRootLogin enabled for SSH

One of the common reasons for not being able to SSH is the root login permission is not given. Let’s discuss how our Support Engineers enable it.

Initially, we login to the server as root.

Now we open the file by running the command

vi /etc/ssh/sshd_config

Then we change the PermitRootLogin from no to yes.

SSH to LXC containers

Now we save the file.

After making the changes we were able to login to LXC container using SSH.

 

Password authentication for SSH

If only key-based is used in the server. The SSH to LXC container will fail. Thus we need to enable Password authentication in the server as well.

Thus we edit /etc/ssh/sshd_config. Then we change PasswordAuthentication from no to yes.

Then we save the file. After that, we were able to SSH to the container.

 

[Need any further assistance with LXC containers? – We’ll help you]

 

Conclusion

In short, we’ve discussed how to SSH to the LXC container. Also, we’ve discussed how our Support Engineers resolve the common errors our customers face.


PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

Submit a Comment

Your email address will not be published. Required fields are marked *