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.

I did something unbelievables stupid

Discussion in 'Database Discussions' started by Dannymh, Jun 30, 2010.

  1. Dannymh

    Dannymh Member

    Joined:
    Jun 30, 2010
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    I was just running a CHOWN and got trigger happy and hit enter when i didnt mean to. As a result I just ran

    CHOWN -R user:user /

    on my VPS, no i cant access anything from cpanel. I can get in there I just cant use any functions like phpMyAdmin etc.

    This is an absolute emergency, I need to get into the database or at least somehow get in back in to backup and just rebuild.

    This will be my major stupid mistake I have done this year I think

    Does anyone know the permissions I need to reset or is there a script that fixes the cpanel permissions so i can at least get in and access cpanel properly again?

    Thanks for you help

    Dan
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,478
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    What directory were you in when you did this?
     
  3. garrettp

    garrettp Well-Known Member
    PartnerNOC

    Joined:
    Jun 18, 2004
    Messages:
    312
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    He mentioned he ran it on /, and assuming he did so as root, then a lot of damage was probably done. If you let the command fully execute, then the damage is going to be extensive and the easiest path is a full reinstall/restore.

    It's not as simple as fixing cPanel's permissions as cPanel relies on a lot of underlying system functions and binaries to operate.

    if you have recent backups, save yourself some headache, reinstall the server and use those. Else you can go about comparing file/directory ownership with a normal server and take the tedious time to manually fix permissions.

    A last-ditch effort if no recent backups are available could be to at least get Perl working, and package up the accounts using /scripts/pkgacct, copy them to a storage location and reinstall. Restoration from these archives can be done through the WHM, though permissions will probably need to be corrected manually after the account restoration process.
     
  4. Miraenda

    Miraenda Well-Known Member

    Joined:
    Jul 28, 2004
    Messages:
    242
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Coralville, Iowa USA
    Just don't leave the SSH window you are in until you fix /root folder itself and /etc/ssh folder to have the right root:root ownership on them. You will also need to fix /usr/sbin and /usr/bin as root:root ownership if you don't have a separate /usr partition as sshd and other vital binaries exist in either /usr/sbin or /usr/bin locations.

    I mention this as I had someone once do this exact same thing (another sysadmin) and I was the only other person on the machine at the time. No-one else could SSH onto it due to all the directories being owned by that user. It was extensively damaged and we had to restore the machine from backup to a new server. This was years ago, but it's a major undertaking to fix.
     

Share This Page