T
T
Twelfth Doctor2018-02-12 11:14:24
linux
Twelfth Doctor, 2018-02-12 11:14:24

How to make automatic LXC authorization?

Hello. I have a host with several LXC containers. The host has an LXC container cont3, and the user vasya.
The user vasya connects to the host via SSH.
How to make it automatically hit the console of the cont3 container?
Those. something like automatic lxc-attach orlxc exec cont3 -- bash

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Shatokhin, 2018-02-12
@Sovigod

Send him port 22 from the container to the world. Let him go straight to the container. There is nothing for him to do in the root system.

A
Alexander Semenenko, 2018-02-12
@semenenko88

Write the following to the user vasya in the home directory in the .bashrc file at the end of the file:
sudo lxc-attach -n cont3
After ssh login, he will be prompted for the sudo password and after entering the password he will go to cont3.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question