[lxc-users] What's the best way to copy file from host to container?

Andrey anrdaemon at yandex.ru
Mon Apr 27 15:45:42 UTC 2015


Greetings, Fiedler Roman.

Monday, April 27, 2015, 09:14:26 you wrote:

>>>> I need to deploy some config files, e.g., .ssh config,  key file etc,  to
>>>> container. I can copy the files to the absolute path in  container, e.g.,
>>>> /usr/local/containers/base/rootfs/root/.ssh/
>>>>
>>>> The  problem is that, I have to change the owner and permission of the
>>>> files  manually. I'm wondering if there is a better way to do it, like scp?
>>>
>>> ls -l /proc/$(lxc-info -n $NAME -p -H)/
>>>
>>> Courtesy @stgraber

>> This seems to be the perfect solution, I can just copy over to the path like
>> proc/12423/root/usr/local, without worrying about snapshot clone uses
>> delta0, rather than root in the container folder. After I moved the file, I 
>> still need to update the file permissions and ownership though.

> What about packing the files with e.g. cpio on the host and injecting them via
> pipe to ns-attached cpio-process running in guest scope.

> This also works around guest to host privilege escalation if malicious guest
> content moves around fs-tree parts while copying.

Could you please elaborate that? May be give an example implementation?


-- 
Sincerely,
Andrey
Monday, April 27, 2015 18:27:17

Sorry for my terrible english...



More information about the lxc-users mailing list