Sujoy Dhar

Well-Known Member
Jul 24, 2016
64
9
8
India
cPanel Access Level
Root Administrator
Twitter
Hi,

I want to place a file ads.txt in all of my cpanel account under public_html

can anyone give me the command where I can copy the file from root to all of the cpanel account's public_html folder.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,295
1,255
313
Houston

Sujoy Dhar

Well-Known Member
Jul 24, 2016
64
9
8
India
cPanel Access Level
Root Administrator
Twitter
I
You can use bash to do this.

Add all the users to a file named users.

cat /etc/userdomains | awk {'print $2'} | sort | uniq > users

Then do a one-liner to copy the file to accounts.

for user in `cat users`; do /bin/cp path-to-ads.txt /home/$user/public_html/; done
it worked :)
 
  • Like
Reactions: cPanelLauren