Error regarding invalid file permissions for upgrading WordPress version

I recently installed wordpress and am working with it locally. The WordPress folder is at the following path: usr/share/wordpress

But the version of WordPress is WordPress 4.9.5 and I want to update it to the latest version: WordPress 5.6.1.

Following is the error I am receiving:

Error text: The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-includes/class-smtp.php, wp-includes/ID3/module.tag.lyrics3.php................

After a Google search and following several links, the error is not resolved. The last command I ran (from usr/share/wordpress) is this

chown www-data:www-data -R *

My current directory and file permissions are as follows:

How do I resolve this error ?

Topic localhost local-installation upgrade errors Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.