If you’re getting a “permission denied” error when trying to edit or upload files through WinSCP or FileZilla in the /var/www/html directory on your Linux web server, it indicates that the user you’re logged in as does not have the necessary permissions to modify those files. Here are a few steps you can take to resolve this issue:
First, you must check Ownership: Verify the ownership and permissions of the /var/www/html directory and its contents. Open a terminal and run the following command:
ls -l /var/www/htmlThis will display a list of files and directories in the /var/www/html directory along with their ownership and permissions. Ensure that the user you’re logged in as has write permissions (e.g., rwx) for the files and directories you want to modify.
If the ownership and permissions are incorrect, you can change them by running the following command:
sudo chown -R your_username: /var/www/htmlReplace your_username with your actual username. The -R option ensures that ownership is recursively applied to all files and directories within /var/www/html.
Next, check Group Permissions: Additionally, you can check if the group ownership and permissions of the /var/www/html directory are appropriate. Run the following command:
ls -l /var/www/htmlEnsure that the group ownership of the files and directories is set to a group that your user account belongs to. If necessary, you can change the group ownership using the chown command:
sudo chown -R your_username:your_groupname /var/www/htmlReplace your_username with your actual username and your_groupname with the appropriate group.
Eureka! You are now, indeed – ROOT! 🙂
