Copy one file into all accounts?
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.
-
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 0 -
While the above would be for existing accounts, for new accounts you can add the ads.txt file into the skeleton directory so it'll be automatically added when creating new accounts. The documentation here should be useful: Skeleton Directory - Version 82 Documentation - cPanel Documentation 0 -
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 :)0
Please sign in to leave a comment.
Comments
3 comments