From 24b6f1ed11d01542840050c4f7e91639ab0b2353 Mon Sep 17 00:00:00 2001 From: Antoine Date: Sun, 19 Jul 2020 23:29:55 +0200 Subject: [PATCH] made container running as non root --- Makefile | 4 ++-- src/container.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a269ab9..8a6ac8f 100644 --- a/Makefile +++ b/Makefile @@ -43,10 +43,10 @@ release: all # debug target valgrind: - @sudo valgrind --leak-check=full --show-leak-kinds=all --trace-children=no --track-origins=yes $(BIN_DIR)/$(TARGET) /bin/ls -la /bin + @valgrind --leak-check=full --show-leak-kinds=all --trace-children=no --track-origins=yes $(BIN_DIR)/$(TARGET) /bin/ls -la /bin run: - sudo $(BIN_DIR)/$(TARGET) /bin/ls -la / + $(BIN_DIR)/$(TARGET) /bin/ls -la / clean: @rm -f $(OBJ_DIR)/*.o diff --git a/src/container.c b/src/container.c index 5468891..e51d49a 100644 --- a/src/container.c +++ b/src/container.c @@ -58,7 +58,7 @@ container_t *initialize_container(struct clone_args cloneArgs) { container_t *c = (container_t *)malloc(sizeof(container_t)); // in order new net ns, new mount ns, new hostname ns, new pid ns, child ns - c->_cloneFlags = CLONE_NEWNET | CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWCGROUP; + c->_cloneFlags = CLONE_NEWUSER | CLONE_NEWNET | CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWCGROUP; c->cloneArgs = cloneArgs; return c; }