HELP ME!! I accidentally gave the command: chown web10:web10 /

Discussion in 'HOWTO-Related Questions' started by Matz Sor, Dec 19, 2020.

  1. Matz Sor

    Matz Sor New Member

    I wanted to change the ownership of a specific folder and I ended up hitting the enter unintentionally when typing, it crashed everything! apache mysql, ispconfig. help me please!!

    Code:
    root@server:~# service mysql start
    Job for mariadb.service failed because the control process exited with error cod                 e.
    See "systemctl status mariadb.service" and "journalctl -xe" for details.
    
     
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Can you 'chown root:root /' now? If not you might have to but off another media, mount your root partition, then run chown.
     
  3. Matz Sor

    Matz Sor New Member

    Thanks for the reply Jesse Norell, I entered Rescue mode
    system offered by vps and mounted the partition, so I managed to redo the 'chown root: root /' command.
    But mysql doesn't run and neither does apache
     
  4. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Messing up ownership of files can cause big issues like this. Some folders have to be owned by Apache, some by ispconfig, etc. Do you have a backup that you can restore? If not, it will take quite some time to restore this correctly by comparing it with a working system...
     
  5. Matz Sor

    Matz Sor New Member

    Th0m, thanks for the reply, I tried to restart, I did everything I knew. a question: if i save the / var / lib / mysql folder with the database and copy it in a new installation, does it work?
     
  6. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Again, do you have a backup (snapshot) of the server that you can go back to?

    You could copy your files to a new installation but it is not a simple copy paste action.
     
  7. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    No.
    The problem is the files have wrong owner and group owner. Copying them to a new installation does not change this.
    If you do not have backups you can restore, only way I can think of is compare with a working similar installation what owners and group owners files have and change accordingly. This is a lot of work. Restoring from backups is preferable.
     
  8. Matz Sor

    Matz Sor New Member

    Thanks for the reply Taleman, I managed to recover the sql files with the command chown -R mysql: mysql /var/lib/mysql + mv /var/lib/mysql/tc.log /var/lib/mysql/tc.log.bkp
    What was blocking mysql from starting was the log.
    Now I'm trying to start Apache
     
  9. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    I would strongly advise you to do a full restore from a snapshot or reinstall as this can cause issues in the future.
     
    Matz Sor likes this.
  10. Matz Sor

    Matz Sor New Member

    the solution was to back up and do a new installation of ispconfig. Thank you very much!
     
  11. MaxT

    MaxT Member HowtoForge Supporter

    a frequent accident and it can be problematic.

    It can be a good idea having a daily cron implementing some idea of the following thread. Some people mentions the metastore solution which was part of Debian, although now it seems outside the distro. Other people mentions acl.
    https://stackoverflow.com/questions...eate-a-script-to-save-and-restore-permissions

    also I have suffered this problem time ago, although still I have not implemented a cron task for this possibility. I must do it one of these days..
     
  12. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Is that solution for admins that do not make backups? Why not start backups from cron?
    If experimenting with changing permissions and owners is done often, consider a file system that support snapshots https://en.wikipedia.org/wiki/Snapshot_(computer_storage).
     
  13. MaxT

    MaxT Member HowtoForge Supporter

    restoring a backup (from yesterday,etc) could change the users files and contents while a restore of permissions could preserve these.
    Although never tried, I will do one of these days.
     
    Taleman likes this.
  14. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter


    more to the point, if experimenting with changing permissions and owners, have a test/staging copy of the live server and do the experiments there. never on a live server.
    and once you've got the required changes worked out, get the scripted, and then retest using the script. then load that script to the live server and run it. that should eliminate the risk of a fat-finger typo creeping in...
     

Share This Page