Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

panthro's avatar

Cannot create a directory?

I have nginx setup on ubuntu and I need to mkdir that I can git clone into. Unfortunately, I do not have permission to do so.

I'm logged in as ubuntu and the /var/www is owned by www-data. What would be the solution here to create a folder?

Note: chmod 777 is not the solution.

0 likes
5 replies
panthro's avatar

@Sinnbeck thanks - that makes the directory, but I am unable to git clone, as ubunutu has access to the ssh key.

Any ideas how to make this all work?

Sinnbeck's avatar

@panthro you can either make a group that both are part of (www-data for instance), or change nginx to run as the ubunutu user

panthro's avatar

@Sinnbeck thanks should ubuntu user be part of www-data or is that a security risk? Should I just set up a generic panthro user instead? Then create ssh keys for panthro user?

Snapey's avatar

make sure ubuntu owns the folder that you are trying to make the new folder in.

You can then change ownership of the new folder to www-data once you have cloned the project

Please or to participate in this conversation.