Permission Denied linux machine executor

Hi i’m new using circleci, I’m facing a permission problem using a linux machine executor, I required to be root all the time for my steps but if I don’t use sudo I get “permission denied”, so I couldn’t create a directory at /, using working directory argument and I’m getting errors, so how can I run my hold build as root

Hi @adam2993,

It looks like you’re creating and modifying directories outside of the default home directory so you need sudo/root permissions. Alternatively, you could work in the default home directory.

yes you are right, but in cases when I use the argument “working directory” and the directory that circleci will create is at /, I get permission denied when I’m using a machine executor… I already solved the problem but I really prefer to use docker image insted of machine executor

1 Like

On your first line (with the sudo mkdir) the sudo part of that only applies to mkdir it does not apply after && of the && cd /c/...
You would need to either add sudo immediately before chmod or you would need to pass the entire set of commands to sudo as a single command option eg
sudo sh -c 'mkdir -p ... && cd /c/... && chmod 777 ...'

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.