====== Access Rights (Linux) ===== Linux stores for each individual file who owns it (owner and group) and what access rights the owner, the group and other users have. The owner can be changed by means of ''[[http://man7.org/linux/man-pages/man1/chown.1.html|chown]]'', the access rights are adjusted by means of ''[[http://man7.org/linux/man-pages/man1/chmod.1.html|chmod]]''. The web server and the PHP process often run with the rights of the user ''www-data'' in the group ''www-data''. If your PHP process runs with a different user name, please replace all ''www-data'' below with the different user name. You will probably transfer the files for SoSci Survey to the server via FTP or SFTP. The files are usually automatically assigned to the FTP user (in the example ''sftp''). The files that are assigned to the user ''sftp'' according to the recommendations can also be assigned to the user ''root'' -- it is only important that they are assigned to the correct group so that the web server and PHP processes have read access to the files. To ensure that SoSci Survey works correctly, we recommend the following owners and access rights. ^File/Directory^Owner:Group^Access rights (''ls -l)''^Access rights (''chmod'')^ |Installation directory\\ e.g. ''/var/www/htdocs/''|www-data:www-data|drwxrwx---|770| |''admin/''\\ z.B. ''/var/www/htdocs/admin/''|sftp:www-data|''%%drwxr-x---%%''|750| |''images/''|:::|:::|:::| |''inc/''|:::|:::|:::| |''layout/''|:::|:::|:::| |''lib/''|:::|:::|:::| |''modules/''|:::|:::|:::| |''plugins/''|:::|:::|:::| |''script/''|:::|:::|:::| |''templates/''|:::|:::|:::| |''system/''\\ z.B. ''/var/www/htdocs/system/''|www-data:www-data|''%%drwxrwx---%%''|770| |''files/''|:::|:::|:::| |''view/''|:::|:::|:::| ===== Installation Directory ===== If you want to adjust owners and access rights for the installation directory according to the above recommendations, use the following commands. You may have to adapt the installation directory (in the example ''/var/www/htdocs''). **Important:** Check that your web server is acting as user ''www-data'' and adjust this user name if necessary before executing the above commands. sudo chown www-data:www-data /var/www/htdocs sudo chmod 770 /var/www/htdocs If you are working as ''root'' (not recommended), you can omit the ''sudo''. ===== Subdirectories ===== cd /var/www/htdocs If you now changed to the installation directory, you can adjust the file rights of the subdirectories with the following commands according to the recommendations. **Important:** Check whether your web server acts as user ''www-data'' and adjust this user name if necessary before executing the above commands. **Important:** Replace the user name ''sftp'' with the user who uploads the files to the server via FTP and updates them if necessary.. sudo chown -R sftp:www-data admin images inc lib layout modules plugins script templates sudo chmod -R 750 admin images inc lib layout modules plugins script templates The directories ''system'', ''view'' and ''files'' are normally created automatically by SoSci Survey and provided with the correct access rights. With the following two commands, the access rights can still be corrected if necessary. sudo chown -R www-data:sftp system sudo chown -R www-data:www-data files view sudo chmod -R 770 system files view The directory ''system'' is intentionally released for the FTP user so that log files can be viewed via FTP.