How can I find the password to www-data group to so I can change directory access rights?

Solution 1:

You're doing it wrong (tm) :)

In your terminal window, look at the "command prompt":

username@hostname:~$

What is username there? You can also try entering whoami[Enter] to see your current username.

From you description it looks like you entered something like

sudo su www-data

or somehow else opened a console session as www-data user. This user has no rights to use sudo command, so your attempts at using sudo fail.

www-data user also has no password set by default, so it is impossible to log in directly as this user. Which is good. You do not want to give it a password.

You need to open another session as your user (or exit your current www-data session) and type the commands there:

sudo chown yourusername:www-data /path/to/directory

which will ask you for your login password.

(or, maybe, just move your stuff to /var/www which already has correct permissions. Then you can add your user to www-data group to get read-write privileges to that directory)