5

System OS: CentOS7.0-64 LAMP for VSI

Problem: I am attempting to change the ownership of two virtual directories from 'root' to 'apache', so that Apache can read and write data. I am using the following commands but to no avail.

 chown -R apache:apache /var/www/html/www.example-virtualhost1.com
 chown -R apache:apache /var/www/html/www.example-virtualhost2.com

When entering these commands I am receiving an error 'command not found.' Any reference material would be greatly appreciated.

Best.

Alfabravo
  • 7,493
  • 6
  • 46
  • 82
Christopher lee
  • 69
  • 2
  • 2
  • 4

1 Answers1

12

In order to change the ownership, try the following line:

sudo chown -R apache /var/www/html/

or

sudo chown apache /var/www/html/www.example-virtualhost1.com

The structure is as follows please note the parentheses as an attempt to explain each piece of the command:

sudo(run the command as root) chown(command to change ownership) -R(recursively change everything within the folder) apache(who you want to be the new owner) /var/www/html/(the folder you would like to modify ownership)

Once you have ran this command, you should be able to type in the following command:

ls -lr 

That command will show you who has ownership.

I hope this helps!

Ikhlak S.
  • 8,578
  • 10
  • 57
  • 77
rishikarri
  • 3,462
  • 2
  • 13
  • 13