Permissions questions for a newbie

A person installed Nextcloud 16 on an ubuntu 18.04 server for me. I am very new to all this, so I did not understand all that he did. (I am grateful for his help, though.)

My understanding is that the data I put on Nextcloud will reside on that server at /mnt/ncdata . When I ssh into the server and am the user that I created when the ubuntu server was first set up, I am unable to change directories to ncdata using sudo. I get an error message that I do not have permission.

I checked the permissions and ownership on ncdata: xrwxrwxr-x; and, the owner and group are www-data and www-data.

Here are my questions:

  1. How can I get access to that directory ncdata? (I don’t need or intend to do anything within that directory, I just am bothered by the thought that there are parts of my ubuntu system that I do not have access to.)

  2. What is the user www-data? Why was it set up, and what is its function? How do I find out its password?

Hi,

It should be possible on your system to run the cd command without sudo. Just

cd /mnt/ncdata

The other option is to become user root. So after you logged in with your user, you run

sudo -i

You are requested to enter your user’s password again (in some cases the password of root user, depending on the system configuration). When you are root be very careful and don’t do anything you don’t fully understand.

The user www-data is a default “system” user and is used by webservers like apache, nginx and so on. It is like the user mysql used by the database you are running.
These users don’t have a password and login as that user is not possible (disabled).
If you need to perform certain steps in that user’s behalf, you can become root user as mentioned above an execute all command with

sudo -u www-data ...

So for example, run php with the NC occ script:

sudo -u www-data php /var/www/nextcloud/occ

Hope that answers it.