Skip to content
This repository was archived by the owner on Mar 22, 2024. It is now read-only.
This repository was archived by the owner on Mar 22, 2024. It is now read-only.

Failed to run the elf file after change capability #5

@fripSide

Description

@fripSide

Hi, after change the capability, I cannot execute the binary anymore.
It seems that we cannot set the capabiltities lager than the bash and init process of the docker?
Does anything go wrong?

Here is my detailed operations.
Change the capability of the elf for dockerfile:

FROM ubuntu:20.04

RUN mkdir -p /work/
COPY setcap /bin/
COPY getcap /bin/
COPY elf_test /work/
WORKDIR /work/
RUN setcap cap_sys_admin+ep elf_test 

Run the docker:

docker build -t dev:v1 .
docker run --rm -it --name dev_test dev:v1 bash 
root@9156b2c0ce2d:/work# getcap elf_test
elf_test = cap_sys_admin+ep
root@9156b2c0ce2d:/work# ./elf_test
bash: ./elf_test: Operation not permitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions