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.

How to copy one file to all subdomains at once?

Discussion in 'General Discussion' started by H4CK3R, Jan 22, 2012.

  1. H4CK3R

    H4CK3R Well-Known Member

    Joined:
    Oct 14, 2011
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Is it possible to copy one file to all my subdomains at once, i dont want to copy one by one, because it takes a lot of time (to 14 subdomains), so is there any way?
    If yes, then please let me know, otherwise please move it to feature request and think about it.
    Thanks.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You could use the following command to copy a file in /home/username/public_html to subdomains and addon domains on the same account:

    Code:
    for i in `grep --exclude="*.cache" documentroot /var/cpanel/userdata/username/* | cut -d: -d' ' -f2-` ;do cp -p /home/username/public_html/filename $i/ ;done
    Please replace username with the account's username and filename with the name of the file.
     
  3. H4CK3R

    H4CK3R Well-Known Member

    Joined:
    Oct 14, 2011
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    But how to use this command? Thanks anyways.
     
  4. storminternet

    storminternet Well-Known Member

    Joined:
    Nov 2, 2011
    Messages:
    462
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    You would need shell access to execute this command. You can login to your account by ssh and execute this command.
    Please refer SSH/Shell Access for more details.
     
  5. linux7802

    linux7802 Well-Known Member

    Joined:
    Dec 14, 2007
    Messages:
    232
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    You can use the command give by Tristan, if you are having the server root login details ...
     
  6. H4CK3R

    H4CK3R Well-Known Member

    Joined:
    Oct 14, 2011
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    But, i cant find any SSH option in cpanel, may be because i am not a root admin....:(
     
  7. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Yes, you cannot do it without root access. You'll have to do it manually or one domain at a time in an FTP client. Otherwise, you could ask the root administrator of the machine to do it for you using the command provided.
     
  8. H4CK3R

    H4CK3R Well-Known Member

    Joined:
    Oct 14, 2011
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Thanks...:)
     
Loading...

Share This Page