ROOT cannot open files from an external hard drive

I am using ROOT 6.28 in LINUX, UBUNTU. I try to open a root file from an external hard drive and ROOT shows the error: name_of_file.root can not be opened for reading Permission denied (TFile *) nullptr. I changed the permissions but nothing seems to work.

That seems more like an OS problem than a ROOT one. Anyway, you need to make sure you have access rights not only for the (.root) file but to the folder (the whole path) where that file is (for instance, are you able to create/delete/etc any other files on the folder where you have that .root file?). So check that; the external drive is probably mounted on /media/yourusername/something (but check with mount); you can use ls with the option -l (small L, meaning “long”) to see all permissions and details for the folders and files; if the owner is not the same as your username, you have to change the permissions accordingly, or just change the owner to your name (you may need to sudo).

Can you please also check if you’re running the Snap version of ROOT. Does the command which root point to /snap/bin/root?

If so, ROOT separately needs to be given access to /mnt and /media, you can do this with sudo snap connect root-framework:removable-media

That worked! thank you very much(: