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!

Help with a small Script

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

  1. UmairSYS

    UmairSYS Member

    Joined:
    May 3, 2016
    Messages:
    6
    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:
    604
    Likes Received:
    43
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  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:
    604
    Likes Received:
    43
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,435
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

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

    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice