Permission issues in var
Background:
I am not sure if something went wrong with update to 66 or working with a Magento installation via SSH, but here's the whole thing:
Two days ago I was working on a faulty Magento 2 installation through SSH and this installation is under a local user account, though I worked with root privileges. Since it was a development environment, I ended up removing it altogether and updated WHM from 64-->66 before going to sleep.
The next morning I received an email from anacron with a long list of logs skipping due to world writable permissions and immediately noticed that all three sites in my server are down with a "permission denied" issue. Then I tried to log in through SSH with no success, receiving an error "putty fatal error: network error: software caused connection abort".
From WHM I could see that most of the files and directories under var/ had changed the permissions to 777, with only a few exceptions. It looks like it was mainly under var but not really in other directories.
I fixed the var/empty and var/empty/sshd permissions to regain access to root and then ran these commands to fix ownership and permissions in the whole system:
This still did not fix the permission denied issue with the sites but changing the permission of /etc/phpmyadmin/config.inc.php from 600 to 644 fixed it. So now I have root access again, emails work and the sites work but there are two issues remaining: [LIST]Now it looks like the owner/permission should be fixed in everything else except var/cpanel and var/lib/mysql, these two directories still have most of the files and subdirectories with permission 777. Is there any easy way to fix the var/cpanel permissions (and the var/lib/mysql)?
the only thing that does not fully work is Installatron. I tried installing Magento via Installatron again and it quits in error while writing databases and tables & I'm looking for the cause of this. It looks like Installatron starts creating directories/tables with permissions 700/660 and this should be correct, though it ends in error
for u in $(rpm -qa); do rpm --setugids $u; done
for p in $(rpm -qa); do rpm --setperms $p; done
This still did not fix the permission denied issue with the sites but changing the permission of /etc/phpmyadmin/config.inc.php from 600 to 644 fixed it. So now I have root access again, emails work and the sites work but there are two issues remaining: [LIST]
-
Two days ago I was working on a faulty Magento 2 installation through SSH and this installation is under a local user account, though I worked with root privileges.
Hello, Could you review the .bash_history file under the account's home directory (or in the /root directory if you used root access) and let us know the specific commands you ran? Thank you.0 -
Hello, Could you review the .bash_history file under the account's home directory (or in the /root directory if you used root access) and let us know the specific commands you ran? Thank you.
Well, I guess this will teach me to log in as local user instead of root in the future. Instead of changing permissions in Magento installation directory I messed up some root permissions with this command that I had run:chmod -Rf 777 /var/
I cleared the installatron issue (was root/root instead of username/username in a few files in local user installation directory) but if there is a way to fix the var/cpanel permissions, I should have everything fixed. Thanks!0 -
Hello, We typically recommend installing the OS and cPanel on a new server and migrating the accounts to the new system when this type of issue occurs. Thank you. 0 -
Hello, We typically recommend installing the OS and cPanel on a new server and migrating the accounts to the new system when this type of issue occurs. Thank you.
We are now moving to a new VPS on the same host and instead of performing live migration, I think we'll go with the fresh install and migration to be sure that any remaining permission issues are fixed at the same time. We will make a full backup and restore all WHM settings/cPanel accounts at the same time through "Restore a Full Backup/cpmove File". But just to be sure, this full backup/restore will not move any of the /var permissions to the new setup, but will move all accounts and settings?0 -
But just to be sure, this full backup/restore will not move any of the /var permissions to the new setup, but will move all accounts and settings?
Hello, Yes, that's correct, however you should consider using "WHM >> Transfer Tool" to copy the accounts and review the transfer logs after the migration completes to verify there were no errors during the transfer process. There's a document you can follow at: How to Move All cPanel Accounts from One Server to Another - cPanel Knowledge Base - cPanel Documentation Thank you.0
Please sign in to leave a comment.
Comments
5 comments