I'm very confused by why I do not have permissions in a certain folder. I installed an app called Grafana which created a user and a group called "grafana" and created some files in /var/lib/grafana/ with ownership to "grafana".

operator@pop-os:/var/lib/grafana$ ls -la total 780 drwxr-xr-x 5 grafana grafana 4096 Mar 10 14:21 . drwxr-xr-x 76 root root 4096 Mar 7 12:09 .. drwxr-x--- 3 grafana grafana 4096 Mar 7 12:09 alerting drwx------ 2 grafana grafana 4096 Mar 7 12:09 csv -rw-r----- 1 grafana grafana 774144 Mar 10 04:21 grafana.db drwx------ 2 grafana grafana 4096 Mar 7 12:09 png 

I'm trying to create a new folder called "plugins" and copy some files in to it but I keep getting "Permission denied".

I have tried adding my user account to the group "grafana" with sudo usermod -aG grafana operator and I even tried adding my account to root group sudo usermod -aG root operator and I still don't have permission. I've tried logging out of account and back in to refresh permissions and it doesn't help.

I can use sudo mkdir plugins but that will create a folder with "root" as the owner, which I don't want because I think Grafana will not be able to access this folder.

What is actually the proper way to create a new folder that belongs to user/group "grafana" but I can still access it with user "operator" if I want to change some content in it?

1

1 Answer

The command you search for is:

sudo -u grafana mkdir plugins 

This will execute the command as user grafana and keep the ownership at eh rest of the directories.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.