Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Permission issues in var

Discussion in 'General Discussion' started by Bayern, Aug 24, 2017.

  1. Bayern

    Bayern Registered

    Joined:
    Aug 24, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    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:
    Code:
    for u in $(rpm -qa); do rpm --setugids $u; done
    Code:
    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:
    • 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
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,220
    Likes Received:
    1,376
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
  3. Bayern

    Bayern Registered

    Joined:
    Aug 24, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    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:
    Code:
    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!
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,220
    Likes Received:
    1,376
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page