Mustafa
Mustafa

Reputation: 339

Showing Permission denied on ubuntu 16.04

I am using Ubuntu 16.04 installed on Virtual box. I have installed LAMP and git successfully. I tried to clone my git repository using terminal but it shows:

fatal: could not create work tree dir 'directory-name': Permission denied

I tried to give directory permission using the following command:

sudo chmod 755 /var/www/html

but it is not working.

Upvotes: 1

Views: 5115

Answers (1)

YoannFleuryDev
YoannFleuryDev

Reputation: 941

It's a fresh install, so the owner of the /var/www/html folder is probably root ? If it is a development environment do the following commands as root, it will probably fix you permissions issue :

groupadd www-data
usermod -a -G www-data yourUsername
chown -R root:www-data /var/www
find /var/www -type d -exec chmod 2775 {} +
find /var/www -type f -exec chmod 0664 {} +

Upvotes: 2

Related Questions