File Permissions After Upgrade


(Jerry Zak) #1

Situation
Happy 5.0.1 user that has upgraded to 5.0.2 using upgrade instructions.
After the upgrade, when going to Pt’s Documents (uploaded PDF scans) I got “The requested document is not present at the expected location […] or there are are not sufficient permissions to access it”.
So I checked the folder permissions and they are all set differently from the original install. Since, during the upgrade, I was logged as myself (not root) the Owner and Group is set to my user name.
Of course on the “original” install the ownership is set to either root or www-data.
The question is then: is there a quick way of fixing all those permissions without re-doing the “upgrade”?

OpenEMR Version
I’m using OpenEMR version 5.0.2

Browser:
I’m using: Chrome & FF

Operating System
I’m using: Ubuntu 18.04.3 LTS on the server

Logs
Did you check the logs? Was there anything pertinent in them? Paste them here (surround with three backticks (```) for readability


(Nilesh Hake) #2

Hi Jerry Zak,

You need to give the www-data permission to your document directory under openemr. Please find the attached image red round should have www-data permission.


For other directory edi, era also should have the www-data permission.

Please refer below link to give the www-data access to the folders “https://askubuntu.com/questions/244406/how-do-i-give-www-data-user-to-a-folder-in-my-home-folder

Thanks,
Nilesh


(Jerry Zak) #3

Thanks Nilesh!

Now, my problem somewhat stems from not completely adhering to the upgrade instructions, as described here >> Linux Upgrade 5.0.1 to 5.0.2

You see… The instructions make you MOVE the document directories (among others) from the old (5.0.1 “backup”) installation to the new (5.0.2).

I would rather COPY them – in doing so I could have the original / working install folder structure intact, waiting just in case that something goes wrong. Then once I am sure that the upgrade has worked as expected, I can get rid of the backup folder / file structure.

But while copying, I have forgotten to use the -a (“archive”) option to preserve ownership & permissions. I got that fixed now.

So… a side note to the OpenEMR wiki gods: perhaps it may make sense to modify instructions to go somewhat like this:

cp -a /var/www/openemr_bk/sites/default/documents /var/www/openemr/sites/default/
cp -a /var/www/openemr_bk/sites/default/edi /var/www/openemr/sites/default/documents/
...

Just a suggestion.