Warning: Undefined array key "HTTP_ACCEPT_ENCODING" in /home/freeguppyorg/sites/ghc.freeguppy.org/inc/hpage.inc on line 45
GuppY Help Center - Install chmods
 

GuppY Help Center, help online, documentation and tutorials

telecharger.png

You are here :   Welcome » Install chmods
    Print this page...

Install chmods

Chmods are a little destabilizing at the beginning and have the reputation to be difficult to apprehend. Here nevertheless some explanations which should enable you to include/understand the reason of their importance and to learn how to install them so that your GuppY site functions well.
 

* Definition


Chmods are the permissions which you install on the files and repertories which constitute your GuppY site. Chmods indicate which actions are authorized and for whom, and this for each file of your site. If Chmods are badly set up, your GuppY online will not work and will return error messages of this kind :

Warning: fopen("data/logh.dtb","w") - Permission denied in http://www.mysite.com/inc/functions.php on line xxx suivant les versions

Warning: Supplied argument is not a valid File-Handle resource in http://www.mysite.com/inc/ functions.php on line xxx suivant les versions

Warning: fopen("../data/logh.dtb", "w") - Read-only file system in functions.php on line xxx suivant les versions

Warning: fputs(): supplied argument is not a valid File-Handle resource in functions.php on line xxx suivant les versions

* At the origin of the chmods : the Unix system


To understand the reason of Chmods, it is necessary to take a look on Unix. Unix being the system used by the majority of the Furnishers of Access Internet (FAI), these ones are tributary of its specificities. One of them, which makes it so popular, is to be a multi-users system. This multi-users management has many advantages : for example, it makes it easier to share files. But it is precisely because it is multi-users, that this system must necessarily include a data protection. Each user of this shared system can thus decide which, among the other users, will be able to see, use and handle the files which belong to him.

The data protection under Unix is controlled as follows : any file created by a user belongs to him and cannot be read, used or modified without its authorization. It is him, the owner of the file, who defines the tasks that the other users will be able to carry out on his files. To this purpose, he will write detailed permissions : they are Chmods. The chmods thus define which actions could be operated on the file and by which users.

• Which actions ?
Basic, they are three and correspond to the three levels of permissions :
- to read the file -> shortened R for Read
- to write on the file - > shortened W for Write
- to carry out the file - > shortened X for eXecute

• which users ?
A hierarchy on three levels controls the unit :
- the user owner of the file - > shortened U for User
- the group to which it belongs - > shortened G for Group (group)
- all others - > shortened A for Anybody (others)

* Why put chmods on GuppY's files ?


When you put your GuppY files on line, you must install the various permissions on the files that you put on your webspace as well as a Unix user. We say that you have to "chmod" files and repertories. Why ? Because GuppY is written in Php and that it offers interactive contents, allowing the visitors of your site to take an active part in the life of the site, while posting in its forum, on its guestbook, etc. When you set up a forum, for example, you have to chmod the files related to the forum so that the visitors can post there some messages. You thus will install a permission RWX, which means that the visitor will be able to read (R), to execute (X) and write (W) on the file related to the forum. If you do not install these access rights, you will be the only one to be able to post on your forum... which is not the idea...

A file can be chmoded in two ways.

* Chmod with letters


It is apparently the favorite method of the advanced users, because it makes it possible to make more sophisticated tasks. The owner of a file under Unix will be able to regulate the permissions for one of his files with such a line :

-rwxr-xr-x 1 toto ppp-user 2454 Feb 05 09:58 guestbook.pl


This line specifies that :
- guestbook.pl is a file: the first sign, the indent -, indicates that it acts of a file. If it had been a repertory, the first sign would have marked D for directory
- toto is the owner of the file named guestbook.pl,
- it reserves himself the right to do everything on the file which belongs to him, namely to read, write and execute the file: it is what the first group of letters rwx indicates, which regulates the permissions of Utilisator owner of the file,
- the other members of the group to which toto belongs (group PPP) have the right only to read and execute the file : it is what the second group of signs r-x indicates which regulates the permissions of Group,
- all the others have the right to read and execute this file : it is what the third group of signs r-x means, which regulates the permissions for All others.

Syntax always preserves order UGA and rwx. Thus the chmod -rwx-wxr-x indicates :
- that it is a file which is chmoded (cf. the initial indent -),
- that Utilisator owner of the file has all the rights (rwx),
- that the users of same Group have the right to write and execute the file, but not to read it (-wx),
- that All others have the right to read and execute the file, but not to write it (r-x).

Note : the indent - indicates that the permission is refused. In r-x, the indent in the place of W indicates that the right to write the file is refused.

* Chmod with figures


It is the most widespread method, easier to implement, when it is well integrated. The basic format of a chmod is xyz file.ext. X, y and z will be replaced by a figure, each figure representing the permissions granted to a group :
• x for U (the user owner of the file)
• y for G (the group to which the user belongs)
• z for A (all other people)

Each permission corresponds to a value :
0 : no permission.
1 : permission (X) to run the file.
2 : permission (W) to write on the file.
4 : permission (R) to read the file.

Ex : to chmod a file so that it is :
- only executable, 1 will be quantified,
- only readable, 4 will be quantified,
- readable and executable, 5 will be quantified,
- readable and scriptible, 6 will be quantified.

Here thus all possible figures, according to the combinations of permissions :

0 no permission : one can neither read, neither to write, nor to run the file.
1 one can only run the file.
2 one can only write the file.
3 one can write and run the file.
4 one can only read the file.
5 one can read the file and run it, but not write it.
6 one can read the file, write it, but not run it (case of the textual files).
7 total permission : one can read, write and run the file.


The order is the same one as in the case of the chmod by letters : UGA and rwx. A file chmoded 756 will thus mean :
- that Utilisator owner of the file is authorized to read the file (4), to write it (2) and to execute it (1), because 4 + 2 + 1 = 7,
- that Group to which it belongs has the right to read the file (4) and to execute it (1), because 4 + 1 = 5,
- that All other people have the right to read the file (4) and to write it (2), because 4 + 2 = 6.

One can also see the things this way:

400 file readable by the owner.
040 file readable by the group.
004 file readable by the others.
200 scriptible file by the owner.
020 scriptible file by the group.
002 scriptible file by the others.
100 executable file by the owner.
010 executable file by the group.
001 executable file by the others.


To determine the rights, one adds the combinations. For example, if I wish that such file be :
- readable by the owner: 400
- readable by the others: 004
- scriptible by the group: 020
- executable by the group: 010
- executable by the owner: 100
- executable by the others: 001,
I will chmod in: 400 + 004 + 020 + 010 + 100 + 001 = 535

* Chmods on directories


Under Unix, a directory is a simple file that can be chmoded the same way that files. What characterizes it is the initial character : D instead of an indent. If they remain syntactically the same ones, the permissions change slightly when they apply to the directories :
- (R) gives the permission to list the files contained in the directory,
- (W) grants the permission to create, rename or erase the files contained in the directory,
- (X) grants the right to use the files of the directory.

* Concretely, how to chmod on my GuppY files ?


First, send your GuppY files on your Web space. Input the URL of your site in the address bar of your browser. If your site is displayed correctly, you do not have to take care of Chmods => it was my case with Free host. On the contrary, you will have to chmod your files if error messages are displayed :

Warning: fopen("data/logh.dtb","w") - Permission denied in http://www.mysite.com/inc/functions.php on line xxx suivant les versions

Warning: Supplied argument is not a valid File-Handle resource in http://www.mysite.com/inc/ functions.php on line xxx suivant les versions

Warning: fopen("../data/logh.dtb", "w") - Read-only file system in functions.php on line xxx suivant les versions

Warning: fputs(): supplied argument is not a valid File-Handle resource in functions.php on line xxx suivant les versions


Ti this purpose, use your FTP client (Filezilla, CuteFP, Leech-ftp for example). Select with the mouse, in the column of right-hand side, the file on which you want to set the permissions (or double-click on the name of the file) and choose the Chmod line or with LeechFTP "set attributes" in the contextual menu which pops up. Check or unchecked the checkboxes according to the permissions to be installed.

At least, files must be "readable" (R), therefore be chmoded 4 with the low word. But GuppY needs specific Chmods as following :

  • Fichiers dossier racine /* 644 (.htaccess 444 possible)
  •     Dossier et sous-dossiers admin 755
  •     Fichiers admin/* 644 (.htaccess 444 possible)
  •     Dossier et sous-dossiers data 755
  •     Fichiers data/* 644 (config/.htaccess 444 possible)
  •     Dossier et sous-dossiers documentation 755
  •     Fichiers documentation/* 644
  •     Dossier et sous-dossiers file 755
  •     Fichiers file/* 644
  •     Dossier et sous-dossiers flash 755
  •     Fichiers flash/* 644
  •     Dossier et sous-dossiers img 755
  •     Fichiers img/* 644
  •     Dossier et sous-dossiers inc 755
  •     Fichiers inc/* 644
  •     Dossier et sous-dossiers mobile 755
  •     Fichiers mobile/* 644
  •     Dossier et sous-dossiers pages 755
  •     Fichiers pages/* 644
  •     Dossier et sous-dossiers photo 755
  •     Fichiers photo/* 644
  •     Dossier et sous-dossiers plugins 755
  •     Fichiers plugins/* 644
  •     Dossier et sous-dossiers save 755
  •     Fichiers save/* 644
  •     Dossier et sous-dossiers skins 755
  •     Fichiers skins/* 644


These chmods are likely to vary apparently according to the web hosts... Tests are in hand to fix the things more clearly.

(Written by Isa ; translated by Binod and Isa) updated by JeandePeyrat


Creation date : 28/01/2014 @ 09:48
Category : - I. Technical help
Page read 15643 times