Hi @Altina Hoti,
It seems like you're facing difficulties while setting the correct permissions for your WordPress installation located at /var/www/wordpress on our Web App - Azure server.
It is important to set the correct file and directory permissions for the security and operation of your WordPress site. Directories are usually 755 permissions (rwxr-xr-x), where the owner can read, write, and execute, and others can read and execute. Files should be 644 permissions (rw-r--r--), with the owner being able to read and write, and others able to read. These files and directories should be owned by the web server user (usually www-data for Apache/Nginx) to function properly.
If directories and files are owned by root or another user, the web server might not have the permissions to read or write, causing problems such as plugin update failure or FTP password prompts. To fix this, you can change ownership by running below command recursively gives ownership to the www-data user and group to all files and directories in /var/www/wordpress:
sudo chown -R www-data:www-data /var/www/wordpress
After correcting ownership set the appropriate permissions:
To set 755
for all directories:
find /var/www/wordpress -type d -exec chmod 755 {} \;
To set 644
permissions for all files:
find /var/www/wordpress -type f -exec chmod 644 {} \;
These commands ensure that directories and files with proper permissions, improving security and functionality.
In case WordPress asks for FTP credentials when updating, it may be a sign of lacking permissions. To enable direct access, include the following line in your wp-config.php file, this parameter allows WordPress to directly edit files without needing FTP credentials.
define('FS_METHOD', 'direct');
Kindly refer to the below links:
https://developer.wordpress.org/advanced-administration/security/hardening/
https://developer.wordpress.org/advanced-administration/server/file-permissions/
https://stackoverflow.com/questions/18352682/correct-file-permissions-for-wordpress
If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.
Let me know if you have any further Queries.