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.

Help with a small Script

Discussion in 'Workarounds and Optimization' started by UmairSYS, Oct 30, 2016.

  1. UmairSYS

    UmairSYS Registered

    Joined:
    May 3, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    PK
    cPanel Access Level:
    Root Administrator
    Hello,

    I am wondering if someone here can help me with a small script.

    I need to go into each cPanel user's public_html directory, download a scrip file (or copy from the same server) and execute it. (Basically trying to patch a security vulnerability across all sites). I can do one by one but wondering if there is a better way to do it.
    So it be like,
    1) Get a list of all cPanel users
    and Run in a loop
    2) cd /home/$username/public_html
    3) wget joomla.org/ptch-001.sh (or cp /root/patch-001.sh /home/$username/public_html/)
    4) sh patch-001.sh
    5) sleep 10

    Can someone here help me with something like this or point me in a direction what would be the best way to do it?

    Thanks
     
    #1 UmairSYS, Oct 30, 2016
    Last edited by a moderator: Oct 31, 2016
  2. SysSachin

    SysSachin Well-Known Member

    Joined:
    Aug 23, 2015
    Messages:
    568
    Likes Received:
    40
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Please try following for loop command on your server to apply security patch for your all user.

    Code:
    for username in `ls /var/cpanel/users` ;do cd /home/$username/public_html ;cp /root/patch-001.sh /home/$username/public_html/ ; sh patch-001.sh ;sleep 10;done
     
  3. Raggie A Pauly

    Raggie A Pauly Registered

    Joined:
    Oct 31, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Thanks for sharing this info here.
     
  4. SysSachin

    SysSachin Well-Known Member

    Joined:
    Aug 23, 2015
    Messages:
    568
    Likes Received:
    40
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    @Raggie A Pauly You are welcome !

    Please update here if need any help related this process.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I've moved this thread to our "Workarounds and Optimization" forum.

    Thanks!
     
Loading...

Share This Page