Home > Mobile >  How can I allow a specific non-root user to run 'docker exec'?
How can I allow a specific non-root user to run 'docker exec'?

Time:11-11

How can I allow a non-root user to run 'docker exec' ?

For example, I would like to allow a user to execute the following command without him obtaining root permissions to the whole system: docker exec -it containerName /bin/bash

This command would allow him to get inside his 'working environment' and do whatever he wants... It would be great to be able to allow this command to him, without password requests

The operating system is Ubuntu server

CodePudding user response:

Here's something I found that seems to give a concise, step-by-step approach to what I'm deducting to be your problem. I will point out, though, that superuser is needed to prepare it.

~Roan

CodePudding user response:

I probably found a solution to the problem.

First of all I ran:

visudo

then I inserted a new line:

studentxx ALL=NOPASSWD:/bin/docker exec -it containerName /bin/bash

then the non root user (studentxx) is able to execute the following command without any problems

sudo docker exec -it containerName /bin/bash
  • Related