最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

docker - Give container's user access to tty even if user is connected via ssh - Stack Overflow

programmeradmin0浏览0评论

I try to setup a development container for embedded firmware development (e.g. adruino). To make remote development possible (with Clion/VS code) I start an ssh server inside the container. Building, compiling over SSH inside the IDE works great!

But I also want to program/flash it from the container (logged in through ssh) to the device. This examples works without SSH:

podman run -it --rm --userns=keep-id --group-add=keep-groups --device=/dev/ttyACM0 ubuntu
cat /dev/ttyACM0

But if i run the same command and login via SSH

podman run -it --rm --userns=keep-id --group-add=keep-groups --device=/dev/ttyACM0 -p 2222:22 ubuntu_with_ssh 
ssh user@localhost -p 2222
cat /dev/ttyACM0

I get cat /dev/ttyACM0: Permission denied.

As it looks like, only PID 1 gets the permission to access devices (even if it is the very same user). And the ssh client isn't running at PID 1.

Question: What can I do, to forward this permissions to the SSH user?

发布评论

评论列表(0)

  1. 暂无评论