Hi, a bit late reply but still might be helpful to someone.
It depends if you have previously added your own user and changed the permissions of the folders and files.
If everything is by default and configuration changes were made, you can try
chown -Rf www-data.www-data /var/www/html/ (for Ubuntu with Nginx)
chown -R nginx.nginx /var/www/ (for CentOS with Nginx)
But then you might need to edit anything from the command line with sudo
Also, you can set the permissions for your user and give the files and directories the following ownership not to use the sudo command
Considering that the location of your WordPress installation is in /var/www/yoursitename/public_html, if it’s any different, please replace accordingly to match your directory structure
sudo chown -Rf yourusername:www-data /var/www/yoursitefolder/public_html/
sudo find /var/www/yoursitefolder/public_html -type d -exec chmod 755 {} \;
sudo find /var/www/yoursitefolder/public_html -type f -exec chmod 644 {} \;
sudo find /var/www/yoursitefolder/public_html/wp-content/ -type d -exec chmod 775 {} \;
sudo find /var/www/yoursitefolder/public_html/wp-content/ -type f -exec chmod 664 {} \;
The first 3 commands will give you the permissions to the WordPress files and directories, and the last 2 commands will give permission for the server.
Also, it is considered a good practice to secure your wp-config.php configuration file.
If you have changed anything in the Nginx or PHP configuration files, in order to reflect the changes you will need to restart the fastcgi service (for example for the PHP7.4) with
sudo systemctl restart php7.4-fpm.service
otherwise it will keep on asking you for your FTP credentials.
And you should be able to normally use the wp-admin from the browser and install/update plugins and themes, as well as edit and change anything inside your site directory as your user without the sudo command.