PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 15, 2022

[FIXED] configure LAMP, cannot copy my files to /var/www/html/

 March 15, 2022     chmod, lamp, linux     No comments   

Issue

i don't know how to chmod files

after typing # ls -al /var/www/html i get this :

  1. drwxr-xr-x. 2 root root 4096 Feb 25 23:23 .
  2. drwxr-xr-x. 6 root root 4096 Feb 25 21:27 ..
  3. -rw-r--r--. 1 root root 34 Feb 25 23:26 index.php

this time being my second time trying to install LAMP on Fedora 15 with the first time ended up reinstall the whole system because i mis-chmod some files

new to linux so please bear with me and be specific

and also first time post my question up here

thx in advance


Solution

chmod is a command used to change the permissions of files in UNIX. While typing ls -al /var/www/html you get a list of files (and hidden files because of the a option) and the permissions they have.

drwxr-xr-x. 2 root root 4096 Feb 25 23:23 .
drwxr-xr-x. 6 root root 4096 Feb 25 21:27 ..
-rw-r--r--. 1 root root 34 Feb 25 23:26 index.php

It can be seen as: ooogggrrr meaning o owner of the file, g group of the owner and r rest of users. Each field can be r/- (value 4), w/- (value 2) and x/- (value 1), meaning read, write and execute.

Then, if you want a file to *ch*ange the *mod*es, you have to do chmod XXX file, where each X corresponds to one group.

So if you want a file to be written, read and executed by the owner, you need 4+2+1=7 permission. We normally set 755 permissions to files in webservers, so that all users can access to all contents, but just the owner can write in there.

So, to sum up, if you have to chmod files on your fedora, you have to give more permissions to the files in a certain directory.



Answered By - fedorqui 'SO stop harming'
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing