사이트, 기본 및 파일 폴더에 대한 올바른 권한? 권한이 올바른지 알아야합니다. site –> 775 site/default –>775 site/default/files –>

이 권한이 올바른지 알아야합니다.

site --> 775
site/default -->775
site/default/files --> 775
site/default/setting.php --> 555


답변

실제로 권한은

sites -> 755
sites/default -> 755
sites/default/files -> 775
sites/default/settings.php -> 444

자세한 내용은 이 질문에 대한 상위 3 가지 답변을 참조하십시오.


답변

에서 드루팔의 공식 핸드북 :

이것을 파일에 복사하고 이름을 “fix-permissions.sh”로 지정하십시오.

#!/bin/bash
if [ $(id -u) != 0 ]; then
        printf "This script must be run as root.\n"
        exit 1
fi
drupal_path=${1%/}
drupal_user=${2}
httpd_group="${3:-www-data}"
# Help menu
print_help() {
cat <<-HELP
This script is used to fix permissions of a Drupal installation
you need to provide the following arguments:
1) Path to your Drupal installation.
2) Username of the user that you want to give files/directories ownership.
3) HTTPD group name (defaults to www-data for Apache).
Usage: (sudo) bash ${0##*/} --drupal_path=PATH --drupal_user=USER --httpd_group=GROUP
Example: (sudo) bash ${0##*/} --drupal_path=/usr/local/apache2/htdocs --drupal_user=john --httpd_group=www-data
HELP
exit 0
}
# Parse Command Line Arguments
while [ $# -gt 0 ]; do
        case "$1" in
                --drupal_path=*)
drupal_path="${1#*=}"
;;
--drupal_user=*)
drupal_user="${1#*=}"
;;
--httpd_group=*)
httpd_group="${1#*=}"
;;
--help) print_help;;
*)
printf "Invalid argument, run --help for valid arguments.\n";
exit 1
esac
shift
done
if [ -z "${drupal_path}" ] || [ ! -d "${drupal_path}/sites" ] || [ ! -f "${drupal_path}/core/modules/system/system.module" ] && [ ! -f "${drupal_path}/modules/system/system.module" ]; then
printf "Please provide a valid Drupal path.\n"
print_help
exit 1
fi
if [ -z "${drupal_user}" ] || [ $(id -un ${drupal_user} 2> /dev/null) != "${drupal_user}" ]; then
printf "Please provide a valid user.\n"
print_help
exit 1
fi
cd $drupal_path
printf "Changing ownership of all contents of "${drupal_path}":\n user => "${drupal_user}" \t group => "${httpd_group}"\n"
chown -R ${drupal_user}:${httpd_group} .
printf "Changing permissions of all directories inside "${drupal_path}" to "rwxr-x---"...\n"
find . -type d -exec chmod u=rwx,g=rx,o= '{}' \;
printf "Changing permissions of all files inside "${drupal_path}" to "rw-r-----"...\n"
find . -type f -exec chmod u=rw,g=r,o= '{}' \;
printf "Changing permissions of "files" directories in "${drupal_path}/sites" to "rwxrwx---"...\n"
cd sites
find . -type d -name files -exec chmod ug=rwx,o= '{}' \;
printf "Changing permissions of all files inside all "files" directories in "${drupal_path}/sites" to "rw-rw----"...\n"
printf "Changing permissions of all directories inside all "files" directories in "${drupal_path}/sites" to "rwxrwx---"...\n"
for x in ./*/files; do
find ${x} -type d -exec chmod ug=rwx,o= '{}' \;
find ${x} -type f -exec chmod ug=rw,o= '{}' \;
done
echo "Done settings proper permissions on files and directories"

이제이 스크립트를 다음과 같이 실행하십시오. sudo bash fix-permissions.sh –drupal_path = your / drupal / path –drupal_user = your_user_name

비올라! 귀하의 권한은 자동으로 고정됩니다.


답변

이것이 Drupal 인스턴스에 대한 권한을 설정하기로 결정한 방법입니다.

mkdir sites/default/files
chgrp -Rv apache sites/default/files
chmod 2775 sites/default/files

chmod 명령에서 2775를 사용하여이 작업을 수행합니다. 2는이 디렉토리에서 작성된 새 파일에 대해 그룹 ID가 보존됨을 의미합니다. 이는 아파치가 항상 파일의 그룹이되므로 웹 서버와 사용자는 항상이 디렉토리에있는 새 파일에 대한 쓰기 권한을 갖도록합니다. 처음 7은 소유자 (예)가 여기에있는 모든 파일을 R (읽기) W (쓰기) 및 X (실행) 할 수 있음을 의미합니다. 두 번째 7은 그룹 (www-data)이이 디렉토리의 모든 파일을 RW 및 X 할 수 있음을 의미합니다. 마지막으로 5는 다른 사용자가 R 및 X 파일을 쓸 수는 있지만 쓸 수는 없음을 의미합니다.

또 다른 요점은 설정에 대한 올바른 권한을 설정하는 것입니다.

chmod 444 sites/default/settings.php

다른 권한이 기본값입니다.

완전한 Drupal 설치 안내서 : http://itvictories.com/node/21


답변

선택된 대답은 특히 정확하지 않습니다. 특히 알 수없는 부분이 적을 때 Aleks 는 그것을 광범위하게 설명했으며 Drupal 사이트에서 취하는 것과 비슷한 접근 방식입니다.

또한 스크립트를 여기에서도 공유하겠다고 생각했지만 Drupal 모듈로서 얼마 전에 만들었습니다. ~/.drush서브 디렉토리에 배치하고 drush file-permissions작업중인 Drupal 사이트 서브 디렉토리에있는 동안 간단히 실행할 수 있습니다 .

그것은 당신의 드루팔 사이트에 대한 검사 부트 스트랩 file_private_path, file_public_path및 올바른 아파치 사용자 및 그룹 설정을. Apache 사용자 / 그룹은 자동으로 결정되므로 사용자가 수동으로 지정하거나 스크립트 파일에 하드 코딩 한 것에 의존하지 않습니다.

모듈 페이지 : https://www.drupal.org/project/file_permissions


답변

다른 사람들이 언급했듯이 올바른 권한은

모든 Drectories-> 755
모든 파일-> 755
sites / default- > 755 (이 디렉토리를 재정의 함)
sites / default / files- > 775 (이 디렉토리 및 그 내용에 대한 규칙을 재정의 함)
sites / default / settings. php-> 444 (이 파일에 대한 규칙을 무시 함)

언급 된 규칙을 달성하기위한 적절한 명령은 Drupal 웹 사이트의 루트에서 다음에 제공됩니다.

find . -type f | xargs chmod 644
find . -type d | xargs chmod 755
chmod 444 sites/default/settings.php
chmod 775 -R sites/default/files