admin管理员组文章数量:1124391
I've got some issues with file permissions which I'm trying to resolve...
I have two sites and they both have the same permissions as far as I can tell but for some reason one site can upload files / read the files in WordPress' media explorer however the other site doesn't.
The server in question is a AlmaLinux server running WHM/cPanel with CloudLinux LVE and LiteSpeed Web Server.
The permissions are as follows:
/home/account/
has account:account
and 711
/home/account/public_html/
has account:account
and 755
/home/account/public_html/.htaccess
has account:account
and 644
/home/account/public_html/website
has account:account
and 755
/home/account/public_html/website/.htaccess
has account:account
and 644
/home/account/public_html/website/wp-config.php
has account:account
and 600
because the file needs to be able to be edited via FTP with the cPanel account login.
/home/account/public_html/website/*.php
have account:account
and 644
After this all other files/folders are:
/home/account/public_html/website/[ALL DIRECTORIES]
have account:account
and 755
/home/account/public_html/website/[ALL FILES]
has account:account
and 644
The following files have all been setup by WordFence Security automatically:
/home/account/public_html/website/wp-content/wflogs/has
account:accountand
755 /home/account/public_html/website/wp-content/wflogs/*.php
have account:account
and 600
By that logic, should Sucuri Security also have the same 600 permissions for their files?/home/account/public_html/website/wp-content/uploads/sucuri/*.php
I created the following script to double check the permissions/ownership and both sites return no issues...
#!/bin/bash
# Define constants
ACCOUNT=account
WORDPRESS=website
ACCOUNT_PATH="/home/${ACCOUNT}"
WORDPRESS_PATH="${ACCOUNT_PATH}/public_html/${WORDPRESS}"
WORDFENCE_LOGS_PATH="${WORDPRESS_PATH}/wp-content/wflogs"
# Function to check file permissions
check_perms() {
local path="$1"
local type="$2" # "file" or "dir"
local perms="$3"
local owner="$4"
local group="$5"
local current_perms=$(stat -c "%a" "$path")
local current_owner=$(stat -c "%U" "$path")
local current_group=$(stat -c "%G" "$path")
if [ "$type" == "file" ] && [ "$current_perms" != "$perms" ]; then
echo "$path - File permissions should be $perms but are $current_perms."
elif [ "$type" == "dir" ] && [ "$current_perms" != "$perms" ]; then
echo "$path - Directory permissions should be $perms but are $current_perms."
fi
if [ "$current_owner" != "$owner" ]; then
echo "$path - Owner should be $owner but is $current_owner."
fi
if [ "$current_group" != "$group" ]; then
echo "$path - Group should be $group but is $current_group."
fi
}
export -f check_perms
export ACCOUNT ACCOUNT_PATH WORDPRESS WORDPRESS_PATH WORDFENCE_LOGS_PATH
# Check specific directories and files
check_perms "${ACCOUNT_PATH}/" "dir" "711" "$ACCOUNT" "$ACCOUNT"
check_perms "${ACCOUNT_PATH}/public_html/" "dir" "755" "$ACCOUNT" "$ACCOUNT"
check_perms "${ACCOUNT_PATH}/public_html/.htaccess" "file" "644" "$ACCOUNT" "$ACCOUNT"
check_perms "$WORDPRESS_PATH" "dir" "755" "$ACCOUNT" "$ACCOUNT"
check_perms "$WORDPRESS_PATH/.htaccess" "file" "644" "$ACCOUNT" "$ACCOUNT"
check_perms "$WORDPRESS_PATH/wp-config.php" "file" "600" "$ACCOUNT" "$ACCOUNT"
# Correctly check all PHP files in the WordPress root directory
find "$WORDPRESS_PATH" -maxdepth 1 -type f -name "*.php" ! -name "wp-config.php" -exec bash -c 'check_perms "$0" "file" "644" "$ACCOUNT" "$ACCOUNT"' {} \;
# Check all directories and files under the WordPress installation
find "$WORDPRESS_PATH" -type d ! -path "$WORDFENCE_LOGS_PATH" -exec bash -c 'check_perms "$0" "dir" "755" "$ACCOUNT" "$ACCOUNT"' {} \;
find "$WORDPRESS_PATH" -type f ! -path "$WORDFENCE_LOGS_PATH/*" ! -name "*.php" -exec bash -c 'check_perms "$0" "file" "644" "$ACCOUNT" "$ACCOUNT"' {} \;
# Special handling for WordFence Security's wflogs directory and files
check_perms "$WORDFENCE_LOGS_PATH" "dir" "755" "$ACCOUNT" "$ACCOUNT"
find "$WORDFENCE_LOGS_PATH" -type f -name "*.php" -exec bash -c 'check_perms "$0" "file" "600" "$ACCOUNT" "$ACCOUNT"' {} \;
I've got some issues with file permissions which I'm trying to resolve...
I have two sites and they both have the same permissions as far as I can tell but for some reason one site can upload files / read the files in WordPress' media explorer however the other site doesn't.
The server in question is a AlmaLinux server running WHM/cPanel with CloudLinux LVE and LiteSpeed Web Server.
The permissions are as follows:
/home/account/
has account:account
and 711
/home/account/public_html/
has account:account
and 755
/home/account/public_html/.htaccess
has account:account
and 644
/home/account/public_html/website
has account:account
and 755
/home/account/public_html/website/.htaccess
has account:account
and 644
/home/account/public_html/website/wp-config.php
has account:account
and 600
because the file needs to be able to be edited via FTP with the cPanel account login.
/home/account/public_html/website/*.php
have account:account
and 644
After this all other files/folders are:
/home/account/public_html/website/[ALL DIRECTORIES]
have account:account
and 755
/home/account/public_html/website/[ALL FILES]
has account:account
and 644
The following files have all been setup by WordFence Security automatically:
/home/account/public_html/website/wp-content/wflogs/has
account:accountand
755 /home/account/public_html/website/wp-content/wflogs/*.php
have account:account
and 600
By that logic, should Sucuri Security also have the same 600 permissions for their files?/home/account/public_html/website/wp-content/uploads/sucuri/*.php
I created the following script to double check the permissions/ownership and both sites return no issues...
#!/bin/bash
# Define constants
ACCOUNT=account
WORDPRESS=website
ACCOUNT_PATH="/home/${ACCOUNT}"
WORDPRESS_PATH="${ACCOUNT_PATH}/public_html/${WORDPRESS}"
WORDFENCE_LOGS_PATH="${WORDPRESS_PATH}/wp-content/wflogs"
# Function to check file permissions
check_perms() {
local path="$1"
local type="$2" # "file" or "dir"
local perms="$3"
local owner="$4"
local group="$5"
local current_perms=$(stat -c "%a" "$path")
local current_owner=$(stat -c "%U" "$path")
local current_group=$(stat -c "%G" "$path")
if [ "$type" == "file" ] && [ "$current_perms" != "$perms" ]; then
echo "$path - File permissions should be $perms but are $current_perms."
elif [ "$type" == "dir" ] && [ "$current_perms" != "$perms" ]; then
echo "$path - Directory permissions should be $perms but are $current_perms."
fi
if [ "$current_owner" != "$owner" ]; then
echo "$path - Owner should be $owner but is $current_owner."
fi
if [ "$current_group" != "$group" ]; then
echo "$path - Group should be $group but is $current_group."
fi
}
export -f check_perms
export ACCOUNT ACCOUNT_PATH WORDPRESS WORDPRESS_PATH WORDFENCE_LOGS_PATH
# Check specific directories and files
check_perms "${ACCOUNT_PATH}/" "dir" "711" "$ACCOUNT" "$ACCOUNT"
check_perms "${ACCOUNT_PATH}/public_html/" "dir" "755" "$ACCOUNT" "$ACCOUNT"
check_perms "${ACCOUNT_PATH}/public_html/.htaccess" "file" "644" "$ACCOUNT" "$ACCOUNT"
check_perms "$WORDPRESS_PATH" "dir" "755" "$ACCOUNT" "$ACCOUNT"
check_perms "$WORDPRESS_PATH/.htaccess" "file" "644" "$ACCOUNT" "$ACCOUNT"
check_perms "$WORDPRESS_PATH/wp-config.php" "file" "600" "$ACCOUNT" "$ACCOUNT"
# Correctly check all PHP files in the WordPress root directory
find "$WORDPRESS_PATH" -maxdepth 1 -type f -name "*.php" ! -name "wp-config.php" -exec bash -c 'check_perms "$0" "file" "644" "$ACCOUNT" "$ACCOUNT"' {} \;
# Check all directories and files under the WordPress installation
find "$WORDPRESS_PATH" -type d ! -path "$WORDFENCE_LOGS_PATH" -exec bash -c 'check_perms "$0" "dir" "755" "$ACCOUNT" "$ACCOUNT"' {} \;
find "$WORDPRESS_PATH" -type f ! -path "$WORDFENCE_LOGS_PATH/*" ! -name "*.php" -exec bash -c 'check_perms "$0" "file" "644" "$ACCOUNT" "$ACCOUNT"' {} \;
# Special handling for WordFence Security's wflogs directory and files
check_perms "$WORDFENCE_LOGS_PATH" "dir" "755" "$ACCOUNT" "$ACCOUNT"
find "$WORDFENCE_LOGS_PATH" -type f -name "*.php" -exec bash -c 'check_perms "$0" "file" "600" "$ACCOUNT" "$ACCOUNT"' {} \;
Share
Improve this question
edited Mar 5, 2024 at 6:44
Roman
1345 bronze badges
asked Feb 23, 2024 at 15:17
RyflexRyflex
8311 bronze badges
3
|
1 Answer
Reset to default 0As you can see in wp-includes/script-loader.php, the exact message 'An error occurred in the upload. Please try again later.' is the default error message.
After looking further in wp-includes/js/plupload/handlers.js you can realize that something specific happened. You could debug this by setting a breakpoint to look up exact error code. See https://stackoverflow.com/a/13372025/2234089 for more information about browser javascript debugging.
Look in to your server error log for PHP errors.
Ensure you don't have conflicts with other themes or plugins, try disabling them all and see if upload still fails.
本文标签: uploadsWordPress Permissions Issue for Media Libraryuploading
版权声明:本文标题:uploads - WordPress Permissions Issue for Media Libraryuploading 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736629132a1945738.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
attachment
that represent the files (on many sites the files aren't on the server at all but on a 3rd party). Also the correct ownership and permissions for you are unique and super specific to you, you need to phrase your question in a way that it works for all people with that question, not just you – Tom J Nowell ♦ Commented Feb 26, 2024 at 8:58