First I created a file in this case filename with the commands I wanted to run inside it. I changed to the rancid user first and then created the file and ran the commands as rancid.
su rancid -s /bin/bash
cat filename
clogin -x filename hostname
Give the full path to clogin if needed, and if there is more than one host being changed use a space between each hostname.