Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Advertise on LowEndTalk.com
clean your cPanel server and adjust user's files permission
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

clean your cPanel server and adjust user's files permission

OvzWebOvzWeb Member
edited August 2014 in Tutorials

hello

1- To clean your server :

note : this command will remove all .gz files stored in /home

rm -rf /home/*.gz (be careful with that)

note : this command will Empty cPanel users trash and remove all backup files created by cpanel user

rm -rfv /home/*/.trash;rm -rfv /home/*/backup*

note : this command will remove all backup files created by cpanel user and stores under public_html

rm -rfv /home/*/public_html/backup*
note : this command will remove all backup files created by server admin and stored under user home dir

rm -rfv /home/*/cpmove*

2- To adjust user's files permission

/scripts/enablefileprotect

/scripts/chownpublichtmls

Thanked by 1VPSSimon

OvzWeb Hosting Solutions | Xen VPS ( Linux- Windows ) Sale! 10% Off Lifetime ::Limited Offer::‏ Disscount Coupon Code is : VPS10Life

Comments

  • @OvzWeb said:

    rm -rf /home/*.gz

    what? no!

  • OvzWebOvzWeb Member

    @Bogdacutuu said:
    what? no!

    to remove any .gz backup files in /home

    OvzWeb Hosting Solutions | Xen VPS ( Linux- Windows ) Sale! 10% Off Lifetime ::Limited Offer::‏ Disscount Coupon Code is : VPS10Life

  • D3vilD3vil Member

    oh man...

  • So you're just removing backups from clients?

  • This is mainly done when alot of clients have multiple backups an have of them now redundent as months old, So cleaning old backups is very very useful to claw back disk space. Although might seem counter-productive, Its simple to -rerun fresh backups or just do cleanup once every 6months just an hour before crons for backups runs.

    That way clients still have backups. - There should be no reason a client would want backups from 6 months ago, Clients prefer recent backups not outdated archives.

  • OvzWebOvzWeb Member

    @VPSSimon said:
    This is mainly done when alot of clients have multiple backups an have of them now redundent as months old, So cleaning old backups is very very useful to claw back disk space. Although might seem counter-productive, Its simple to -rerun fresh backups or just do cleanup once every 6months just an hour before crons for backups runs.

    That way clients still have backups. - There should be no reason a client would want backups from 6 months ago, Clients prefer recent backups not outdated archives.

    in cPanel servers usually backup stored in /backup/cpbackup

    Thanked by 1VPSSimon

    OvzWeb Hosting Solutions | Xen VPS ( Linux- Windows ) Sale! 10% Off Lifetime ::Limited Offer::‏ Disscount Coupon Code is : VPS10Life

  • This is true but i think some functions do store in /home/ as ive personally cleaned a clients vps recently which had alot of backups in /home/ But also contained backups for SQL within /home/$username

    So the above commands wouldn't fully clean But would help clean up majority. I wouldn't personally mess with cpbackup folder leave cpanel to do rotation an clean on that. Just ones outside normal cpanel cleanups i.e home dir.

  • CentrioHostCentrioHost Member
    edited July 2013

    for user in '/bin/ls -A /var/cpanel/users' ; do rm -fv /home/$user/backup-*$user.tar.gz ; done

    for user in '/bin/ls -A /var/cpanel/users' ; do rm -rf /home/$user/backup-*$user ; done

    The commands are safe to remove user created backups.

    CentrioHost LLC - Reliable Shared and Multilevel Reseller Hosting Provider since 2007

    15$/yr. SSD Hosting | Free Domain Reseller | SSL Certificates | More ...

  • OvzWebOvzWeb Member

    @CentrioHost said:
    The commands are safe to remove user created backups.

    Very Nice Commands
    are you allow to edit post and insert your command ?

    OvzWeb Hosting Solutions | Xen VPS ( Linux- Windows ) Sale! 10% Off Lifetime ::Limited Offer::‏ Disscount Coupon Code is : VPS10Life

  • tommytommy Member

    @OvzWeb said:
    hello

    1- To clean your server :

    note : this command will remove all .gz files stored in /home

    rm -rf /home/*.gz

    I prefer
    rm -rf * /home/*.gz.backup
    kidding

    Let's bet which dot-name will collapse first ;)

  • tommytommy Member
    edited July 2013

    double post ------------

    Let's bet which dot-name will collapse first ;)

  • prae5prae5 Member

    @VPSSimon said:
    That way clients still have backups. - There should be no reason a client would want backups from 6 months ago, Clients prefer recent backups not outdated archives.

    Disagree!!!!!!

  • This command is dangerous!!!
    rm -rfv /home//public_html/backup

    can remove any files or directories which name starts "backup" which i dont think is wanted! even serious client files can be named that way

    InternetLifeForum.com - hosting, webmaster forum

Sign In or Register to comment.