Alhamdulillah, there is an easy way to solve this problem as I found it here (https://www.chrisabernethy.com/why-wordpress-asks-connection-info)
1. First, you need to know who user is running your webserver:
Create a new blank file and paste this syntax in it.
<?php echo(exec("whoami")); ?>
Save the file in whatever title.
2. Make the identified user above own the wordpress directory. Log in as root in your command prompt. Then execute this command:
chown -R httpd: YOUR_WORDPRESS_DIR
For example, if the wordpress directory is in /var/www/wp_dir, you can execute this:
chown -R httpd: /var/www/wp_dir
Finally, you can upload any themes into your webserver successfully.