I am learning penetration testing, and I am trying to perform linux privilege escalation using docker. So I created a new user with the minimum permissions and I added it to the docker group. The problem now is that this new user cannot run docker.

I tried to change the permission for this user using chmod but it does not work. Can anyone help me please to permit the new user to run docker!! this is the new user:

pentester:x:1001:1001::/home/pentester:/bin/bash

and this is the docker group:

docker:x:976:anasgharsa,pentester

and when I am connected with the new user and try docker images or docker ps I get this error message : "unable to get absolute bin path: stat .: permission denied"

Pino's user avatar

Pino

9,1237 gold badges56 silver badges74 bronze badges

asked Sep 1, 2023 at 14:55

Anas Gharsa's user avatar

It seems like user doesn't have the necessary permissions to run Docker. I hope that you have included your user "pentester" in the following way: sudo usermod -aG docker pentester

First confirm that user is a member of the "docker" group, you can run the following command as the root user: grep '^docker:' /etc/group

If not then add the user by executing following command: sudo usermod -aG docker pentester

Confirm the user's membership in the "docker" group by executing the following command: groups pentester

Restart the docker services by the following command: sudo service docker restart

Start a new shell session.

answered Sep 1, 2023 at 18:47

Vansh Damania's user avatar

2