Sunday, September 28, 2014

VPS for WordPress basics [Part 6] - Authorization of files / folders (CHMOD)

This is an extremely important concept that you will need to explain your understanding of the Linux world to the next step we will go into setting up a Web server to run WordPress.
So here we will have something that it important? As the title it is a decentralized file / folder, or use another term that you may have seen a lot of it is CHMOD .
chmod-comic
CHMOD is a decentralized concept for Linux file that you need to hold firmly because it involves confidential information on the server, so if you are not properly prepared chmod it will easily be exploited from hackers outside.

I. What is Decentralization?

In Linux, when it comes to separation of powers, we will think of three basic powers of a user / group that the file / folder that includes:
  • r (read) - the right to read the file / folder
  • w (write) - permission to write / edit content files / folders
  • x (execute) - the right to execute the file / folder. For the directory, you need to have the right to execute the new cd command to access the
Ok, now you try to do the following (in his previous post guidelines even then):
  • Log into SSH with root user
  • Create a new user with any name, then set a password for it
  • Exit out of SSH, log in with the user you created
  • Even at the user's folder, create a file quickly empty the command name by anyname-file touch
  • Even at the user's folder, create a folder with any name
  • Type the command ls l to view the files attached to newly created details of its
Results will be returned as follows:
1
2
3
4
5
6
[Van @ vpscanban ~] $ touch  testfile
[Van @ vpscanban ~] $ mkdir  testfolder
[Van @ vpscanban ~] $ ls  l
total 4
rw-rw-valve r-- 1 0 Sep 21 19:47 testfile
drwxrwxr-x 2 valve 4096 Sep 21 19:47 testfolder
Look out for his help 2 lines okay:
1
2
rw-rw-valve r-- 1 0 Sep 21 19:47 testfile
drwxrwxr-x 2 valve 4096 Sep 21 19:47 testfolder
I would like to explain by following the pattern below:
01
02
03
04
05
06
07
08
09
10
11
rw-rw-valve r-- 1 0 Sep 21 19:47 testfile
drwxrwxr-x 2 valve 4096 Sep 21 19:47 testfolder
__________________________________________ ^ - Date of file creation and file name
^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | \ --- The size of the file / folder
| | | | | | \ -------- Ownership group name
| | | | | \ --------------- Name user property
| | | | \ ---------------------- Number is difficult to explain, because no important omitted
| | | |
| \ - \ - \ ----------------------------- The decentralization index
\ ------------------------------------- File (word d means directory)
The important issue here is that we will analyze the decentralization index wool pile on.
The first is the  rw-rw-r-- , at this stage you can see it has one of the hyphen ( - ). it means that not enough rights for its turn, each right would be described by a sign - .Specifically:
  • rw- : The first object is the user rights for owning it.
  • rw- : second object is the right group for users of its own.
  • r-- : Tuesday object is for ANY user rights are not owned and non-owned group.
So the stage  rw-rw-r-- means " User valve is allowed to read and modify files, the user group of valves can read and edit the file, and the rest of the file is read only ".
But that's just one of the performers the right type of file, but one type that is represented in digital form again. Specifically:
  • Rights r is represented by the number 4.
  • Right w is represented by the number 2.
  • Right x is represented by the number 1.
If an object that has enough 3 this right, you just get all 3 combined is 4 + 2 + 1 = 7, so the right number 7 means it is allowed to read, edit and execute files. For example, paragraph rw-rw-r-- , I have a calculation as follows:
1
2
3
4
rw - rw - r - -
4 2 0 4 2 0 4 0 0
| | | | | | | | |
\ 6 / \ 6 / \ 4 /
So concludes that paragraph  rw-rw-r-- will be represented by the number 664 .This is the default permissions for files.
Similarly, paragraph  rwxrwxr-x means that in line 2 will be represented by the number775 . This is the default permissions for the folder.
Now you can try creating a new user by another, then login with this user in the user folder you created above to see it when the error is not enough access rights. Next practice bringing new users into the group of owners and users to try again. This is where you review all previous knowledge.

II. Change the permissions for files / folders

You definitely understand decentralized system on Linux yet? If, then, you will always need to understand how to change permissions for files and folders is like.
For distribution rights for all files / folders on Linux, you would use the command calledchmod . This command structure is used:
1
chmod  [options] [Performing decentralization] [name of file  or directory]
In particular, the [options] is not required to, include the following options:
  • v : show report after running the command. If you chmod multiple files / folders at once, then every time it's right to change one file / folder will now finish the report.
  • -c : same as above, but only when it's all done.
  • f : Understand short, like "fuck it", if an error occurs it will not notice.
  • R : If you CHMOD a folder is attached to R means always applied to files / folders inside it.
  • --help : display a help message.
At the [performances decentralization], represented by the ban can be 3 types:
  • type of character: same as above (rw-rw-x-).
  • ugo type: This type of decentralized authorization for each object.
  • numeric: the same as above (644).
For example:
  • chmod 775 testfile
  • chmod 400 testfolder
  • chmod u + s testfolder (allowing all members not belonging to the owner and not under the ownership group can execute folder)
A few more examples of the type ugo:
  • o + RWS: allows the user to have full ownership rights
  • g + rw: allows group owner to read and write
  • u + w: Allows the user has permission to read the rest
  • a + RWS: allow all users have full rights (777)

Epilogue

This all seems a bit much but that word does not mean too difficult to understand, make it very easy to understand if you take the time to carefully read and follow. In the following article, I will guide you step by step how to install a LAMP Webserver (Linux + Apache + MySQL + PHP) to be able to run a website basic WordPress on VPS.

0 nhận xét:

Post a Comment